Quinn Chan
Quinn Chan

Reputation: 31

How to change the text orientation of stacked bar chart created with Plotly Express?

I am completely new to data visualisation with Plotly. I've created a stacked bar chart with text labels, but the single-digit value have rotated automatically. How can I make all texts shown without being rotated?

fig = px.bar(
    data_stack,
    y = "newform",
    x = "percentage",
    color = "Qcat",
    barmode = "stack",
    text = "size",
    orientation = "h")

Here's a screenshot for reference:

enter image description here

Upvotes: 3

Views: 3665

Answers (1)

tzinie
tzinie

Reputation: 772

fig.update_traces(textangle=0)

Upvotes: 7

Related Questions