Multicategory Axis: How many categories are allowed?

Hi there

can I use mutlitcategory axis with more than two categories ?

I tried to enhance the previously posted example by adding an additional category (β€œ2020”) but only two (2020 and BB+/BB) are shown in the chart . Am I missing something or is it not possible to have more categories ?

Thanks !

import plotly.graph_objects as go
x = [[β€œ2020”, β€œ2020”, β€œ2020”, β€œ2020”, β€œ2020”, β€œ2020”],
[β€œ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()

Hi @sunshine, this is not possible at the moment with plotly. There is an open issue for this https://github.com/plotly/plotly.js/issues/2175 you can subscribe to the issue to get notified about future progress. Also if your organization has a software budget, sponsoring the development of a feature is possible. In the meantime you can probably add supplementary tick labels with annotations.

1 Like

I have just started with Plotly, saw this as a nice problem to try to tackle, and just posted the work so far. Available in https://codepen.io/richardnm-2/pen/RwyjMrB. Results with plotly.py at Extend multicategory axes to more than 2 levels Β· Issue #2175 Β· plotly/plotly.js Β· GitHub.
Maybe give it a try, let me know what you think of it!