I have created a seaborn pairplot and I want to change the size of the legend's title. I have done that with:
matrix = sns.pairplot(...)
lg = plt.gcf().legend(title='something')
lg.get_title().set_fontsize(30)
Is there a more elegant way to do this?
I know that matplotlib -used by seaborn- does not have a related property as discussed here: https://github.com/matplotlib/matplotlib/issues/8699
Note that from matplotlib 3.0 on , you will be able to change the legend title font-size via
ax.legend(..., title_fontsize=16)
or
plt.rcParams['title_fontsize'] = 16
Until then,
legend = ax.legend(...)
legend.get_title().set_fontsize(16)
is indeed the appropriate way to set the legend title.
更改剧情图例的标题字体大小
plt.title('something', fontsize=16)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.