该
tick_params方法对于这样的事情非常有用。此代码关闭主要和次要刻度线,并从x轴删除标签。
from matplotlib import pyplot as pltplt.plot(range(10))plt.tick_params( axis='x', # changes apply to the x-axis which='both', # both major and minor ticks are affected bottom=False, # ticks along the bottom edge are off top=False, # ticks along the top edge are off labelbottom=False) # labels along the bottom edge are offplt.show()plt.savefig('plot')plt.clf()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)