36
我需要你的幫助!我有其下面的一個繪圖代碼:Python matplotlib減少了彩條標籤的大小
fig = plt.figure()
ax1 = fig.add_subplot(111)
imax1 = ax1.imshow(data,interpolation = 'nearest', origin = 'lower',cmap=cm.jet)#plot
cbar = plt.colorbar(imax1, extend='neither', spacing='proportional',
orientation='vertical', shrink=0.7, format="%.0f")
cbar.set_label(r"ET [mm/month]", size=10)
titlestr = "Evapotranspiration in mm/month"
plt.title(titlestr)
#plt.xlabel("Longitude")
#plt.ylabel("Latitude")
imax1.set_clim(0,60)
labels = [item.get_text() for item in ax1.get_xticklabels()]
for ii in range(np.shape(labels)[0]):
labels[ii] = str(grid_lon[75*ii/np.shape(labels)[0]])
ax1.set_xticklabels(labels, rotation = 45, ha='right', size = 10)
labels = [item.get_text() for item in ax1.get_yticklabels()]
for ii in range(np.shape(labels)[0]):
labels[ii] = str(grid_lat[75*ii/np.shape(labels)[0]])
ax1.set_yticklabels(labels, size = 10)
pngname = "./out/2d_"+variable+"_"+mm+".png"
print "save ", pngname
plt.savefig(pngname, dpi=None, facecolor='w', edgecolor='w',
orientation='portrait', papertype=None, format=None,
transparent=False, bbox_inches=None, pad_inches=0.1)
print "plot finished"
我想的彩條標籤(例如0,10,20,... 60)的標籤尺寸設置爲10或更小的尺寸。這可能會進入「imax1.set_clim(0,60)」這一行。任何想法?我也有興趣將imax1對象的信息打印到命令行。我該怎麼做?例如,可用的屬性和功能imax1 。
我深深感謝您的幫助
部分答案:'打印目錄(imax1 )'會給你提供信息g'imax1'的可用屬性和功能。 – crayzeewulf 2013-03-09 00:55:04
非常感謝,我執行了較低的一個。 – user1113953 2013-03-09 09:05:18