如何使用 seaborn FacetGrid 更改字体大小? [英] How can I change the font size using seaborn FacetGrid?
本文介绍了如何使用 seaborn FacetGrid 更改字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经用 seaborn
中的 factorplot
绘制了我的数据并获得了 facetgrid
对象,但仍然无法理解如何在其中设置以下属性这样的情节:
I have plotted my data with factorplot
in seaborn
and get facetgrid
object, but still cannot understand how the following attributes could be set in such a plot:
- 图例大小:当我绘制大量变量时,我得到的图例非常小,字体也很小.
- y 和 x 标签的字体大小(与上述类似的问题)
推荐答案
您可以在调用 sns.set()
时放大字体.
You can scale up the fonts in your call to sns.set()
.
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
x = np.random.normal(size=37)
y = np.random.lognormal(size=37)
# defaults
sns.set()
fig, ax = plt.subplots()
ax.plot(x, y, marker='s', linestyle='none', label='small')
ax.legend(loc='upper left', bbox_to_anchor=(0, 1.1))
sns.set(font_scale=5) # crazy big
fig, ax = plt.subplots()
ax.plot(x, y, marker='s', linestyle='none', label='big')
ax.legend(loc='upper left', bbox_to_anchor=(0, 1.3))
这篇关于如何使用 seaborn FacetGrid 更改字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文