2016-05-15 207 views
0

ヒートマップカラーバーのフォントサイズを変更したかったのですが、Seaborn、カラーバーのフォントサイズを変更

次は私のコードです:

import seaborn as sns 
import matplotlib.pyplot as plt 
from numpy import arange 
x = arange(25).reshape(5, 5) 
cmap = sns.diverging_palette(220, 20, sep=20, as_cmap=True) 
ax = sns.heatmap(x, cmap=cmap) 
plt.show() 

私はplt.tick_params(axis='both', labelsize=20)と目盛りラベルを変更することができました。ただし、カラーバーのフォントサイズは変更されません。 これを行う方法はありますか?

enter image description here

答えて

2

あなたが望むスケールへfont_scaleのparamを設定seaborn.set()方法でフォントのスケールを変更することができ、seaborn documentationでより多くを参照してください。例えば

、スケール3と、あなたのプロット:

import seaborn as sns 
import matplotlib.pyplot as plt 
from numpy import arange 
# here set the scale by 3 
sns.set(font_scale=3) 
x = arange(25).reshape(5, 5) 
cmap = sns.diverging_palette(220, 20, sep=20, as_cmap=True) 
ax = sns.heatmap(x, cmap=cmap) 
plt.show() 

plot with big font scale

関連する問題