Reputation: 21961
In the following plot, the font size seems to be different for x and y axis. I am not sure what is causing it. I am using the following rcParams:
rcParams['mathtext.default']='regular'
rcParams['axes.labelsize'] = 9
rcParams['xtick.labelsize'] = 9
rcParams['ytick.labelsize'] = 9
rcParams['legend.fontsize'] = 9
rcParams['font.family'] = 'serif'
rcParams['font.serif'] = ['Computer Modern Roman']
rcParams['figure.figsize'] = 7.3, 4.2
and this is how I set the x axis labels:
labels = [item.get_text() for item in ax.get_xticklabels()]
labels[0] = 'Col A'
labels[1] = 'Col B'
labels[2] = 'Col C'
ax.set_xticklabels(labels,rotation=0)
and this is how I set the y axis label:
ax.set_ylabel('Percentage')
How do I get consistent fonts in x and y axis labels?
Upvotes: 0
Views: 779
Reputation: 10771
Modify your code to specify fontsizes,
fs=9
ax.set_xticklabels(labels,rotation=0, fontsize=fs)
and,
ax.set_ylabel('Percentage', fontsize=fs)
You can set the y-axis tick fontsizes as,
for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(fs)
Good luck.
Upvotes: 2