如何使所有Y轴标签在Plotly Gannt图表上显示?
我发现的其他答案说要设置y轴tick:1,但我无法弄清楚将其添加到我的代码中以使其正常工作。
我当前的代码:
fig = px.timeline(df, x_start="Offer Date", x_end="Decision Date", y="Employer")
fig.update_yaxes(autorange="reversed") # otherwise tasks are listed from the bottom up
fig.show()
当所有条形图都出现在图表上时,只有其他所有Yaxis标签都出现。
Other answers I found said to set y axis ticks: 1, but I cannot figure out where to add this into my code to make it work.
My current code:
fig = px.timeline(df, x_start="Offer Date", x_end="Decision Date", y="Employer")
fig.update_yaxes(autorange="reversed") # otherwise tasks are listed from the bottom up
fig.show()
While all of the bars appear on the chart, only every other yaxis label shows up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如@pythonbear指出的那样,添加
fig.update_layout(yaxis = {'dtick':1})
解决了这个问题,它对我有用。
As @PythonBear pointed out, adding
fig.update_layout(yaxis={'dtick':1})
solves this issue, it did the trick to me.