python - Python matplotlib:旋转条形图的 x 轴标签
问题描述
刚开始编码,我还没有完全理解绘图。我正在创建一个帕累托图,我的条形标签很长。我从另一个线程复制了情节代码。如何旋转标签(45 或 90 度)
编码:
fig, ax = plt.subplots()
ax.bar(counts_clean_cutoff['error'], counts_clean_cutoff["counts"], color="C0")
ax2 = ax.twinx()
ax2.plot(counts_clean_cutoff['error'], counts_clean_cutoff["cumpercentage"], color="C1", marker="D", ms=7)
ax2.yaxis.set_major_formatter(PercentFormatter())
ax.tick_params(axis="y", colors="C0")
ax2.tick_params(axis="y", colors="C1")
plt.show()
谢谢!
解决方案
推荐阅读
- javascript - 如何在不重写代码的情况下使用一个 CSS 模块并为其添加另一种样式?
- java - 嗨,我是 spring 新手,我想在我的索引页面中创建一个输入,该输入可以作为我的控制器的 getmapping 的值我该怎么做
- android - Fastlane android 构建:缺少 index.android.bundle
- certificate - RSA2048签名输出Base64length
- javascript - Firebase 用户身份验证
- .net - (DOCKER) 服务不会从特定用户开始
- hdfs - 在 Flink 集群上集成 Hadoop 3.x 的问题
- c - scanf 期望多一个值(VS Code)
- gcc - 我可以强制链接器使用静态库而不是动态库吗?
- typescript - 是否可以访问 *.spec.js 文件中的 nuxt 上下文?