【发布时间】:2019-05-13 15:17:06
【问题描述】:
我在调整图表 y 轴上数字标签的字体大小时遇到了一些问题。调整字体大小似乎只是调整图例框中的文字。
调整“轴”不起作用,因为我使用了axes.ravel() 来帮助给出一组 2x2 的四个子图。
"axes.set_xlabel(fontsize='large', fontweight='bold') 属性错误: 'numpy.ndarray' 对象没有属性 'set_xlabel'"
#The part of the code that creates the subplots.
fig, axes = plt.subplots(nrows=2, ncols=2, figsize=(40,20), squeeze=False, sharey=True)
axes = axes.ravel()
font = FontProperties()
font = {'weight' : 'bold','size' : 22}
plt.rc('font', **font)
#Then under here are the loops that create each subplot.
for each_subplot in range(0,4):
axes.set_xlabel(fontsize='large', fontweight='bold')
#Selecting the input data goes here, but I left it out.
【问题讨论】:
标签: python python-3.x matplotlib