【发布时间】:2015-04-03 05:36:40
【问题描述】:
我在互联网上查看,绝对所有具有多个轴的示例的 xlabel 和 ylabel 的默认值都非常小
我使用以下代码来创建坐标区:
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
...
ax=[]
if twoaxes or threeaxes:
ax.append(host_subplot(111, axes_class=AA.Axes))
plt.subplots_adjust(right=0.75)
else:
ax.append(fig.add_subplot(111))
if twoaxes or threeaxes:
ax.append(ax[0].twinx())
if threeaxes:
ax.append(ax[0].twinx())
offset = 60
new_fixed_axis = ax[2].get_grid_helper().new_fixed_axis
ax[2].axis["right"] = new_fixed_axis(loc="right", axes=ax[2],offset=(offset, 0))
ax[2].axis["right"].toggle(all=True)
我尝试用 3 种方法更改字体大小,但都失败了
1)
ax[i].set_xlabel(xlabel, fontsize = fontsize)
2)
fontd = {'family' : 'serif',
'color' : 'darkred',
'weight' : 'normal',
'size' : fontsize,
}
ax[i].yaxis.set_label_text(ylabel, fontdict=fontd)
和 3)
ax[i].xaxis.get_label().set_fontsize(fontsize)
这些方法都不起作用,并且鉴于到目前为止所有示例都显示轴标签的字体非常小,我想这要么是古怪的困难,要么是不可能的。在这个阶段欢迎任何想法。
我忘了说当轴是用
创建的 fig.add_subplot(111)
上面提到的所有方法都可以正常工作,并且字体大小已更改。
【问题讨论】:
标签: matplotlib font-size host multiple-axes