Skip to content

Instantly share code, notes, and snippets.

@moritzkoerber
Created August 22, 2020 14:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moritzkoerber/c132675a06f490bf3f0ec467ee369348 to your computer and use it in GitHub Desktop.
Save moritzkoerber/c132675a06f490bf3f0ec467ee369348 to your computer and use it in GitHub Desktop.
import plotly.graph_objects as go
fig = go.Figure()
fig.update_layout(
template="simple_white",
xaxis=dict(title_text="Week"),
yaxis=dict(title_text="Count"),
barmode="stack",
)
colors = ["#2A66DE", "#FFC32B"]
for r, c in zip(df.response.unique(), colors):
plot_df = df[df.response == r]
fig.add_trace(
go.Bar(x=[plot_df.week, plot_df.layout], y=plot_df.cnt, name=r, marker_color=c),
)
fig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment