如何在Python中用长字符串绘制X轴?

发布于 2025-02-03 07:14:18 字数 251 浏览 1 评论 0原文

当我尝试用长字符串绘制一些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 enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葮薆情 2025-02-10 07:14:18

解决方案是:首先,正如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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文