99网
您的当前位置:首页python plt x轴坐标按1刻度显示

python plt x轴坐标按1刻度显示

来源:99网
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator

x_major_locator = MultipleLocator(1)
ax = plt.gca()
ax.xaxis.set_major_locator(x_major_locator)  # x轴按1刻度显示

# ls_num是你已有的列表数据,存放纵坐标内容
plt.plot(ls_num)  # y轴变量
plt.ylabel('count')  # y轴名字
plt.show()

因篇幅问题不能全部显示,请点此查看更多更全内容