我正在创建一个在右边距中包含文本的图形,但该图形正在切断。我试过调整figsize
,但无济于事。有没有办法增加右边距宽度,以便所有边距文本都可见?
models = ['GISS-E2-H', 'MRI-CGCM3', 'bcc-csm1-1-m', 'IPSL-CM5A-LR', \
'CanESM2', 'CESM1-BGC', 'IPSL-CM5B-LR', 'inmcm4', 'GISS-E2-R',\
'IPSL-CM5A-MR', 'MPI-ESM-MR', 'GFDL-CM3', 'CCSM4', 'bcc-csm1-1',\
'NorESM1-M', 'GFDL-ESM2M', 'CESM1-CAM5', 'HadGEM2-ES', \
'CSIRO-Mk3-6-0', 'CNRM-CM5', 'ACCESS1-3', 'CMCC-CESM', 'CMCC-CMS',\
'NorESM1-ME', 'MPI-ESM-LR', 'ACCESS1-0', 'BNU-ESM', 'MIROC5', \
'CMCC-CM', 'EC-EARTH', 'GFDL-ESM2G', 'MIROC-ESM', 'MIROC-ESM-CHEM',\
'FGOALS-g2']
for idx, model in enumerate(models):
# Plot the marker as the model number
plt.text(stdv_changes[idx], mean_changes[idx], str(idx+1), fontsize=12)
# Add right margin text (model number - model)
y_loc = .9 - (1./40.)*int(idx)
plt.figtext(.925, y_loc, '{0:2d} - {1}'.format(idx+1, models[idx]), fontsize=8)
plt.ylim(-10,15)
plt.xlim(-5,10)
plt.axvline(linewidth=.25, linestyle='dashed', color='black')
plt.axhline(linewidth=.25, linestyle='dashed', color='black')
plt.xlabel('Standard deviation change (cm)')
plt.ylabel('Mean change (cm)')
plt.show()
答案 0 :(得分:2)
看看这个question。您可以在致电plt.show()
之前执行此操作:
plt.subplots_adjust(right=.8) # or even smaller number to shift the right edge to the left