'python plotly - rotating secondary X axis labels

Let's say I create a plotly figure like this:

x = [['A','A','B','B'], ['X','Y','X','Y']]
y = [1,2,3,2]
fig = go.Figure()
fig.add_bar(x=x, y=y)
fig.show()

I get this: enter image description here I want to rotate the secondary X labels ('A' and 'B'). I tried:

fig.update_xaxes(tickangle=45)

but this only rotates the 'X' and 'Y' labels. How can I do it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source