I am trying to create a grouped, stacked bar chart as seen below. I made this version in Excel but I would like to use plotly to create it. I am struggling to make the groupings and the two-levels of x-labels.
1 Like
The documentation shows how to handle a basic version of this, Bar Charts with multicategory axis type
The following code (copied from the link above) will produce the following graph.
import plotly.graph_objects as go
x = [
["BB+", "BB+", "BB+", "BB", "BB", "BB"],
[16, 17, 18, 16, 17, 18,]
]
fig = go.Figure()
fig.add_bar(x=x,y=[1,2,3,4,5,6])
fig.add_bar(x=x,y=[6,5,4,3,2,1])
fig.update_layout(barmode="relative")
fig.show()
@RicardoR4556 May be this helps Control distance between stacked bars? - #3 by windrose