簡體   English   中英

Seaborn:如何增加軸上標簽的字體大小?

[英]Seaborn: How to increase the font size of the labels on the axes?

下面是我如何 plot 熱 map:

sns.heatmap(table, annot=True, fmt='g', annot_kws={'size':24})

問題是, size僅設置熱圖中數字的字體大小。 我應該在annot_kws中使用哪個參數來設置軸上標簽的字體大小?

謝謝

您不能直接在對 heatmap 的調用中更改它們,但您可以指示heatmap 直接在plt.rcParams中或使用上下文管理器更改字體大小:

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')

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM