如何在 Plotly Express 上将团队名称(x 轴)旋转到 90\xc2\xb0?它们没有以正确的方式转动。
\n这是我的代码。
\nfig = px.bar(stacked_ratio, y="percent", x="team", color="outcome", \n color_discrete_map=colors, title="Long-Form Input")\nfig.show()\nRun Code Online (Sandbox Code Playgroud)\n\n
Cam*_*ell 29
您应该能够使用以下方法从图形对象更新 x 轴update_xaxes:
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()
Run Code Online (Sandbox Code Playgroud)
您可以在此处查看fig.update_xaxesplotly网站上的所有选项:https://plotly.com/python/reference/layout/xaxis/