From d5ed60d1adfdd20fba9f78961ee0b2d0666917c1 Mon Sep 17 00:00:00 2001 From: mishavelthuis Date: Thu, 15 Aug 2024 11:20:56 -0500 Subject: [PATCH] Added data source --- README.org | 12 +++++++----- interactive-plot.py | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.org b/README.org index 6e48693..9c9ef9d 100644 --- a/README.org +++ b/README.org @@ -2,9 +2,11 @@ This repository is described in [[https://mishathings.org/2024-08-12-how-much-co2-has-been-emitted-in-my-lifetime.html][this]] blog post. -You can find here: +To create the graph I used the data behind [[https://ourworldindata.org/grapher/cumulative-co-emissions][this]] graph, which I downloaded [[https://nyc3.digitaloceanspaces.com/owid-public/data/co2/owid-co2-data.csv][here]]. -- A Jupyter Notebook that produces the graph I describe in the post. -- A html export of that notebook. -- The data that the code works with (although it also allows for the fetching of data online) -- The code that runs on my VPS, which produces this interactive graph: http://mishathings.org:8050/ +This repo contains: + +1. A Jupyter Notebook that produces the graph I describe in the post. +2. A html export of that notebook. +3. The data that the code works with (although the code also allows for the fetching of online data) +4. The code that runs on my VPS, which produces this interactive graph: http://mishathings.org:8050/ diff --git a/interactive-plot.py b/interactive-plot.py index 2cb76a3..6491a1f 100644 --- a/interactive-plot.py +++ b/interactive-plot.py @@ -52,7 +52,7 @@ app = dash.Dash(__name__) app.layout = html.Div([ - html.P('1. Works best on Desktop 2. Use the slider to adjust the graph 3. Hoover mouse over graph to see (i.a.) the download button', style={'textAlign': 'left'}), + html.P('1. Works best on desktop 2. Use the slider to adjust the graph 3. Hoover mouse over graph to see (i.a.) the download button', style={'textAlign': 'left'}), dcc.Slider( id='year-slider', min=min_year, @@ -109,7 +109,7 @@ def update_graph(year_born): fig.add_trace(fig_vline.data[0]) - fig.update_layout(title_text='Percentage of global CO2 emissions since 1750\n occurring in your lifetime (last updated: %s)
%s' % (df['year'].iloc[-1],subtitle), + fig.update_layout(title_text='Percentage of global CO2 emissions since 1750 occurring in your lifetime (last updated: %s)
%s' % (df['year'].iloc[-1],subtitle), xaxis_title="percentage", yaxis_title="year of birth") @@ -120,7 +120,7 @@ def update_graph(year_born): fig.add_annotation( text=explainer, xref="paper", yref="paper", - x=0.95, y=0.95, showarrow=False, + x=0.99, y=0.98, showarrow=False, align="left", font=dict(size=16), bgcolor="lightcoral",