join the Figure Friday session on August 1, at noon Eastern Time, to showcase your creation and receive feedback from the community.
Which country generated the most electricity? How have emissions changed over time?
Answer these questions and a few others by using Plotly and Dash on electricity generation and emissions in Europe.
Things to consider:
- what can you improve in the app or sample figure below (line chart)?
- would you like to tell a different data story using a different graph?
- can you create a different Dash app?
Sample figure:
Code for sample figure:
from dash import Dash, dcc
import dash_ag_grid as dag
import plotly.express as px
import pandas as pd
# Download CSV sheet from Google Drive: https://drive.google.com/file/d/1q_2EQ4gx_BLKSuwfMZcmCqetY1UV8BD1/view?usp=sharing
df = pd.read_csv("europe_monthly_electricity.csv")
df_filtered = df[df['Variable'] == 'Demand']
df_filtered = df_filtered[df_filtered['Area'].isin(['France', 'Germany', 'Spain', 'United Kingdom', 'Cyprus', 'Switzerland'])]
fig = px.line(df_filtered, x='Date', y='Value', color='Area')
grid = dag.AgGrid(
rowData=df.to_dict("records"),
columnDefs=[{"field": i, 'filter': True, 'sortable': True} for i in df.columns],
dashGridOptions={"pagination": True},
columnSize="sizeToFit"
)
app = Dash()
app.layout = [
grid,
dcc.Graph(figure=fig)
]
if __name__ == "__main__":
app.run(debug=True)
For community members that would like to build the data app with Plotly Studio, but don’t have the application yet, simply click the Apply For Early Access
button on Plotly.com/studio and fill out the form. You should get the invite and download emails shortly after. Please keep in mind that Plotly Studio is still in early access.
Below is a screenshot of a Plotly Studio app built on top of this dataset:
Participation Instructions:
- Create - use the weekly data set to build your own Plotly visualization or Dash app. Or, enhance the sample figure provided in this post, using Plotly or Dash.
- Submit - post your creation to LinkedIn or Twitter with the hashtags
#FigureFriday
and#plotly
by midnight Thursday, your time zone. Please also submit your visualization as a new post in this thread. - Celebrate - join the Figure Friday sessions to showcase your creation and receive feedback from the community.
If you prefer to collaborate with others on Discord, join the Plotly Discord channel.
Data Source:
Thank you to EMBER for the data.