如何更改seaborn.dislot图形的字体大小?

2024-05-19 23:26:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试更改seaborn.dislot中图形标题的字体大小

我有以下代码:

f = sns.displot(df,x="yearOfRegistration", kde=True, binwidth=5)
f.set(title = "Distribuição de Veículos com base no Ano de Registro")
f.set_axis_labels("Ano de Registro","Densidade (KDE)")

plt.show()

我的输出是:

ouput

所以,我试过这个:

f = sns.displot(df,x="yearOfRegistration", kde=True, binwidth=5)
f.set(title = "Distribuição de Veículos com base no Ano de Registro", font_size = 20)
f.set_axis_labels("Ano de Registro","Densidade (KDE)")

plt.show()

我有

"AttributeError: 'AxesSubplot' object has no property 'font_size'"

我查阅了所有seaborn文档,但找不到解决方案

有人能帮我吗? 谢谢


Tags: notruedftitledeseabornsetregistro