最佳答案
我正在使用 matplotlib.pyplot 模块绘制一个直方图,我想知道如何强制 y 轴标签只显示整数(例如0、1、2、3等)而不显示小数(例如0)。,0.5,1.,1.5,2.等)。
I'm looking at the guidance notes and suspect the answer lies somewhere around Matplotlib.pplot.ylim but so far I can only find stuff that sets the minimum and maximum y-axis values.
def doMakeChart(item, x):
if len(x)==1:
return
filename = "C:\Users\me\maxbyte3\charts\\"
bins=logspace(0.1, 10, 100)
plt.hist(x, bins=bins, facecolor='green', alpha=0.75)
plt.gca().set_xscale("log")
plt.xlabel('Size (Bytes)')
plt.ylabel('Count')
plt.suptitle(r'Normal Distribution for Set of Files')
plt.title('Reference PUID: %s' % item)
plt.grid(True)
plt.savefig(filename + item + '.png')
plt.clf()