Skip to content

Instantly share code, notes, and snippets.

@justinhchae
Last active January 12, 2021 14:59
Show Gist options
  • Save justinhchae/9cfbc053b9bce786013fcc5bc7e9d2b1 to your computer and use it in GitHub Desktop.
Save justinhchae/9cfbc053b9bce786013fcc5bc7e9d2b1 to your computer and use it in GitHub Desktop.
import plotly.graph_objects as go
import plotly_express as px
# group the dataframe
group = df.groupby('types')
# create a blank canvas
fig = go.Figure()
# each group iteration returns a tuple
# (group name, dataframe)
for group_name, df in group:
fig.add_trace(
go.Scatter(
x=df['dates']
, y=df['count']
, fill='tozeroy'
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment