Skip to content
Snippets Groups Projects
Commit c202d34c authored by Laura Marcela Becerra's avatar Laura Marcela Becerra
Browse files

changes in Cambio Climatico

parent abe055f2
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,14 @@ Los datos, recolectados durante muchos años, revelan los signos y patrones de u
## Incremento de la temperatura
````{margin}
```{note}
Aqui va una explicacion de la grafica !
```
````
```{code-cell}
:tags: [hide-input]
......@@ -56,7 +64,7 @@ fig.update_layout (
xaxis_title="Año",
yaxis_title="Anomalía Térmica",
autosize=False,
width=800,
width=750,
height=500,
margin=dict(
l=50,
......@@ -108,104 +116,14 @@ fig.show()
```
## Emisión de CO$_2$
```{code-cell}
:tags: [hide-input]
import plotly.graph_objs as go
import pandas as pd
from plotly.subplots import make_subplots
#df = pd.read_csv(r'https://nyc3.digitaloceanspaces.com/owid-public/data/co2/owid-co2-data.csv')
df = pd.read_csv('./datos/owid-co2-data.csv')
continents = ['Europe','North America','South America','Asia','Oceania']
co2continents = df[df['country'].isin(continents)]
co2continents = co2continents.rename(columns={"country": "Región"})
fig = make_subplots(rows=1, cols=2)
#fig= go.FigureWidget()
labels = ['Europa','América del Norte','América del Sur','Asia','Oceania']
colors= ['rgb(31, 119, 180)', 'rgb(255, 127, 14)',
'rgb(44, 160, 44)', 'rgb(214, 39, 40)',
'rgb(148, 103, 189)', 'rgb(140, 86, 75)',
'rgb(227, 119, 194)', 'rgb(127, 127, 127)',
'rgb(188, 189, 34)', 'rgb(23, 190, 207)']
ymax = co2continents["year"].max()+10
ymin = co2continents["year"].min()-10
i=0
for c in continents:
df = co2continents[co2continents['Región']== c ]
fig.add_scatter( x = df['year'], y = df['co2'] , name=labels[i],legendgroup=labels[i],text=labels[i], row=1, col=1,
line=dict(color=colors[i]) )
i+=1
i=0
for c in continents:
df = co2continents[co2continents['Región']== c ]
fig.add_scatter( x = df['year'], y = df["share_global_co2"] , name=labels[i], legendgroup=labels[i],text=labels[i], row=1, col=2,
showlegend=False, line=dict(color=colors[i]) )
i+=1
<center><iframe width="600" height="350" src="https://www.youtube.com/embed/LwRTw_7NNJs" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe><center>
note = 'datos tomados de https://ourworldindata.org/co2-and-greenhouse-gas-emissions'
fig.add_annotation(
showarrow=False,
text=note,
font=dict(size=10),
xref='x domain',
x=1.6,
yref='y domain',
y=-0.205
)
## Aumento del nivel del mar
fig.update_layout (
xaxis_title="Año",
yaxis_title="co2 [Toneladas]",
xaxis2_title="Año",
yaxis2_title="Porcentaje global [%]",
autosize=False,
width=1200,
height=500,
margin=dict(
l=50,
r=50,
b=50,
t=50,
pad=4),
legend_title="Región",
font=dict(
family="Rockwell",
size=16,
#color="RebeccaPurple"
),
plot_bgcolor='rgba(0,0,0,0)'
)
fig.update_xaxes(
ticks='outside',
showline=True,
linecolor='black',
gridcolor='lightgrey',
range=[ymin,ymax]
)
fig.update_yaxes(
ticks='outside',
showline=True,
linecolor='black',
gridcolor='lightgrey'
)
fig.show()
```
## Retroceso de los Glaciares
......
---
jupytext:
cell_metadata_filter: -all
formats: md:myst
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.11.5
kernelspec:
display_name: Python 3
language: python
name: python3
---
# Causas y efectos del cambio climático
## Emisión de CO$_2$
```{code-cell}
:tags: [hide-input]
import plotly.graph_objs as go
import pandas as pd
from plotly.subplots import make_subplots
#df = pd.read_csv(r'https://nyc3.digitaloceanspaces.com/owid-public/data/co2/owid-co2-data.csv')
df = pd.read_csv('./datos/owid-co2-data.csv')
continents = ['Europe','North America','South America','Asia','Oceania']
co2continents = df[df['country'].isin(continents)]
co2continents = co2continents.rename(columns={"country": "Región"})
fig = make_subplots(rows=1, cols=2)
#fig= go.FigureWidget()
labels = ['Europa','América del Norte','América del Sur','Asia','Oceania']
colors= ['rgb(31, 119, 180)', 'rgb(255, 127, 14)',
'rgb(44, 160, 44)', 'rgb(214, 39, 40)',
'rgb(148, 103, 189)', 'rgb(140, 86, 75)',
'rgb(227, 119, 194)', 'rgb(127, 127, 127)',
'rgb(188, 189, 34)', 'rgb(23, 190, 207)']
ymax = co2continents["year"].max()+10
ymin = co2continents["year"].min()-10
i=0
for c in continents:
df = co2continents[co2continents['Región']== c ]
fig.add_scatter( x = df['year'], y = df['co2'] , name=labels[i],legendgroup=labels[i],text=labels[i], row=1, col=1,
line=dict(color=colors[i]) )
i+=1
i=0
for c in continents:
df = co2continents[co2continents['Región']== c ]
fig.add_scatter( x = df['year'], y = df["share_global_co2"] , name=labels[i], legendgroup=labels[i],text=labels[i], row=1, col=2,
showlegend=False, line=dict(color=colors[i]) )
i+=1
note = 'datos tomados de https://ourworldindata.org/co2-and-greenhouse-gas-emissions'
fig.add_annotation(
showarrow=False,
text=note,
font=dict(size=10),
xref='x domain',
x=1.6,
yref='y domain',
y=-0.205
)
fig.update_layout (
xaxis_title="Año",
yaxis_title="co2 [Toneladas]",
xaxis2_title="Año",
yaxis2_title="Porcentaje global [%]",
autosize=False,
width=1200,
height=500,
margin=dict(
l=50,
r=50,
b=50,
t=50,
pad=4),
legend_title="Región",
font=dict(
family="Rockwell",
size=16,
#color="RebeccaPurple"
),
plot_bgcolor='rgba(0,0,0,0)'
)
fig.update_xaxes(
ticks='outside',
showline=True,
linecolor='black',
gridcolor='lightgrey',
range=[ymin,ymax]
)
fig.update_yaxes(
ticks='outside',
showline=True,
linecolor='black',
gridcolor='lightgrey'
)
fig.show()
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment