Data Science Asked by vraka0723 on July 3, 2021
I have the following graph that I created using plotly but I would like to space the grouped bar plots (based on quarter) a little bit apart.
This is the code I used:
df = pd.melt(billed_rev['EMEA'][7:13], id_vars=['Fiscal Year/Period'],value_vars=['Val1','Val2','Val3','Val4','Val5'])
fig = go.Figure()
fig.update_layout(
template="simple_white",
xaxis=dict(title_text="Quarter"),
yaxis=dict(title_text="Revenue"),
barmode="group",
bargap=0.2,
bargroupgap = 0.0)
colors = ["darkgoldenrod", "darkblue","darkcyan","olive","lightblue"]
for r, c in zip(df['variable'].unique(), colors):
plot_df = df[df['variable'] == r]
fig.add_trace(
go.Bar(x=[plot_df['Fiscal Year/Period'], plot_df['variable']], y=plot_df['value'], name=r, marker_color=c,text=plot_df['value'],
textposition='outside'),
)
fig.show()
How do I space these out?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP