Dear all,
I have been looking at this example: (https://plot.ly/python/waterfall-charts/) What I want to do is to split each bar within the waterfall to show me the contribution of lets say my International vs Local for each group. ie. Sales bar should be split in two showing me what portion is Local and what portion is International. Is this possible?
Regards,
import plotly.graph_objects as go
fig = go.Figure(go.Waterfall(
name = “20”, orientation = “v”,
measure = [“relative”, “relative”, “total”, “relative”, “relative”, “total”],
x = [“Sales”, “Consulting”, “Net revenue”, “Purchases”, “Other expenses”, “Profit before tax”],
textposition = “outside”,
text = ["+60", “+80”, “”, “-40”, “-20”, “Total”],
y = [60, 80, 0, -40, -20, 0],
connector = {“line”:{“color”:“rgb(63, 63, 63)”}},
))
fig.update_layout(
title = “Profit and loss statement 2018”,
showlegend = True
)
fig.show()
This would be handled with layout.waterfallmode
but at the moment we only support side-by-side and overlay, not stacking.
Dear aetingu,
Did you manage to figure this one out? Or would anyone else mind kindly sharing some code on this, I can’t seem to get it working and can’t find much documentation.
I tried:
fig.update_layout(
waterfallmode=‘overlay’
)
Is it also possible to get the stacked bar groups to correspond to the legend? i.e. legend colour corresponding to International, Local
Hello honestshiba -
Were you able to develop a work around to stack the waterfall chart and color the legend accordingly? It seems like we’re looking to create very similar charts.
nicolaskrucheten - are there any plans to support stacking in the near future? I feel this feature would be very helpful to the Plotly community. Or is it possible to modify a bar chart and add connectors to create a custom solution?
Thank you
Hi @nicolaskruchten ,
I’ve been doing some research and am wondering if I can somehow contribute to Stacked waterfall charts #4450 - Stacked waterfall charts · Issue #4450 · plotly/plotly.js · GitHub. The image posted by jdb78 is exactly what I am looking for and I can’t find another way to replicate the graph.
I think this solution would fill a large gap in Python’s data visualization capabilities and attract more developers to Plotly.
Thank you!
Thanks for the interest! Your best bet is to comment in the issue signalling your interest, and one of the Plotly.js developers should be able to orient you towards making a pull request!
Thank you! I will comment in the issue. Appreciate your help.