我正在寻找一种防止标签重叠的方法。在Stackoverflow中搜索时,我甚至找不到任何关于如何控制x轴间距的建议。
matplotlib.pyplot.xticks(x, xticks, rotation=90)
matplotlib.pyplot.plot(x, y)
matplotlib.pyplot.bar(x, y, alpha=0.2)
matplotlib.pyplot.title(
f"średnia cena produktu {self.identifier}, według kontrahentów")
matplotlib.pyplot.xlabel("kontrahent")
matplotlib.pyplot.ylabel("cena")
matplotlib.pyplot.tight_layout()
matplotlib.pyplot.savefig(os.path.join(
"products", self.identifier, "wykres.png"))
matplotlib.pyplot.close()
首先,如果没有你的数据,很难知道到底发生了什么,所以我不得不创建虚拟数据,并调整变量“self.identifier”和“xticks”,因为我们不知道它们是什么。
也就是说,你要找的功能是
如下代码所示:
相关问题 更多 >
编程相关推荐