Added data source

This commit is contained in:
mishavelthuis 2024-08-15 11:20:56 -05:00
parent c650c0fb66
commit d5ed60d1ad
2 changed files with 10 additions and 8 deletions

View file

@ -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/

View file

@ -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)<br><sub>%s</sub>' % (df['year'].iloc[-1],subtitle),
fig.update_layout(title_text='Percentage of global CO2 emissions since 1750 occurring in your lifetime (last updated: %s)<br><sub>%s</sub>' % (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",