✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

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