如何在Python中用长字符串绘制X轴?
when I tried to plot some X-axis variables with long strings I got this result , I thought if I could put it on it's side it could better but I didn't knew how . I will be
thankful if you help me with better solution
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是:首先,正如Grismar在评论中所说的使用plt.xticks(旋转='垂直'或您想要的角度数),然后转到底部的“配置子图”(如下图中所示)图窗口的窗口尝试调整它以使其看起来不错,然后将底部和左和向右的底部和右侧和右侧的数量放入代码中= 0.917,顶部= 0.9)。
here is the documentation about subplots_adjust
和关于 plt.xticks()和一些和一些和一些 和一些 a href =“ https://www.geeksforgeeks.org/matplotlib-pyplot-xticks-inpicks-in-python/” rel =“ nofollow noreferrer”>示例
the solution is : First as Grismar said in the comments use plt.xticks(rotation='vertical' or the number of the angle you want) , then go to "configure subplots"(as it shows in the picture below) in the bottom of plot window try to adjust it to look good , and then take the numbers of bottom and top and left and right and put it in code with plt.subplots_adjust() example:plt.subplots_adjust(bottom=0.476,left=0.057,right=0.917,top=0.9).
here is the documentation about subplots_adjust
and documentation about plt.xticks() and some examples