简体   繁体   中英

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:

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

ax.plot(Xaxis, Yaxis)

Poor quality graph made in MSPaint

Use need to use plt.xticks(Xaxis) :

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

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

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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