简体   繁体   English

如何 plot xticks 两次

[英]How to plot xticks twice

I have just began to write python codes lately and don't have much knowledge.最近才开始写python代码,知识不多。 So I have this code that plots a graph using matplotlib and I would like it to mark the xticks twice.所以我有这段代码使用 matplotlib 绘制图表,我希望它标记 xticks 两次。 But as you may already know the code only results in the second one.但正如您可能已经知道的那样,代码只会导致第二个。

Here is the part of my code where I try to mark the xticks where I want:这是我的代码的一部分,我尝试在我想要的地方标记 xticks:

plt.xticks([min(AcceptableCapacityIndex),max(AcceptableCapacityIndex)],rotation=90)
plt.xticks(np.arange(int(Cycle[0]),int(Cycle[-1]),int(Cycle[-1])/20),rotation=90)

You can try你可以试试

plt.xticks(np.arange(int(Cycle[0]),int(Cycle[-1]),int(Cycle[-1])/20),rotation=90)</code> to set the ticks and <code>plt.xlim(min(AcceptableCapacityIndex),max(AcceptableCapacityIndex))

to set the x-axis limits.设置 x 轴范围。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM