问题
Here's how I plot the heat map:
sns.heatmap(table, annot=True, fmt='g', annot_kws={'size':24})
The thing is, size
set only the font size of the numbers inside the heatmap. Which parameter I should use in annot_kws
to set the font size of the labels on the axes?
Thanks
回答1:
You cannot change those directly in the call to heatmap
, but you can instruct matplotlib to change the font size either in plt.rcParams directly, or using a context manager:
uniform_data = np.random.rand(10, 12)
plt.figure()
with plt.style.context({'axes.labelsize':24,
'xtick.labelsize':8,
'ytick.labelsize':16}):
ax = sns.heatmap(uniform_data, annot=True, fmt='.1f', annot_kws={'size':6})
ax.set_xlabel('x label')
来源:https://stackoverflow.com/questions/65058295/seaborn-how-to-increase-the-font-size-of-the-labels-on-the-axes