我绘制了一个图表,其中 y 轴上的比例很大(10^6),但是此时轴显示的是整数。如何让轴以标准形式显示?
range_v=142
max_actual_diff=0
max_ID=0.0
for i in range(0,fev[ind_2008].shape[0]):
id_temp=ID[ind_2008[i]]
ind_2009_temp=np.where(ID[ind_2009] == id_temp)
actual_diff=fev[ind_2008[i]]-fev[ind_2009[ind_2009_temp]]
if actual_diff > max_actual_diff:
max_actual_diff=actual_diff
max_ID=id_temp
diff=np.abs(fev[ind_2008][i]-fev_p1)
pdf_t, bins_t=np.histogram(diff,bins=range_v-1,range=(0,range_v))
if i == 0:
pdf=pdf_t
pdf[:]=0.0
pdf=pdf+pdf_t
print max_actual_diff, max_ID
#plot result
x=[max_actual_diff]*3000001
y=np.arange(0,3.000001e6,1)
bincenters = 0.5*(bins_t[1:]+bins_t[:-1])
fig3=plt.figure()
plt.plot(bincenters,pdf)
plt.plot(x,y)
plt.xlim(0,142)
plt.ylim(0,3e6)
plt.xlabel('Diff in FEV Measurements')
plt.ylabel('Frequency')
plt.legend(['Diff in FEV Measurements','max diff between recorded fevpctECFSPR'],loc='best')
plt.title('FEVPCT')
#plt.show()
plt.savefig('FEV.jpg')