[英]How to rotate xtick label bar chart plotly express?
您应该能够使用update_xaxes
方法从图形对象更新 x 轴:
fig = px.bar(stacked_ratio, y="percent", x="team", color="outcome",
color_discrete_map=colors, title="Long-Form Input")
fig.update_xaxes(tickangle=90)
fig.show()
您可以在 plotly 网站上查看fig.update_xaxes
所有选项: https ://plotly.com/python/reference/layout/xaxis/
fig.update_xaxes(tickangle= -90) fig.show()
Tickangle=90 表示标签将顺时针旋转 90°。 如果使用负号,则将标签逆时针旋转 90°,因此只是另一个方向。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.