简体   繁体   English

可变x轴间隙matplotlib

[英]Variable xaxis gap matplotlib

so I'm trying to do spacing based on the value when doing a graph matplot lib for example with these values:所以我尝试在执行图形 matplot lib 时根据值进行间距,例如使用这些值:

Xaxis = [1, 2, 5]
Yaxis = [1, 2, 3]

ax.plot(Xaxis, Yaxis)

Poor quality graph made in MSPaint用 MSPaint 制作的劣质图表

Use need to use plt.xticks(Xaxis) :使用需要使用plt.xticks(Xaxis)

Xaxis = [1, 2, 5]
Yaxis = [1, 2, 3]

plt.plot(Xaxis, Yaxis)
plt.xticks(Xaxis) # <--- here

在此处输入图像描述

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

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