简体   繁体   中英

How can i change the font-size of my seaborn.displot graphic?

I'm trying to change the font-size of my graphic title in seaborn.displot .

I have this code:

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

My output goes:

ouput

So, I tried this:

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

And I have

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

I've looked all over the seaborn documentation and coudn't find the solution.

Can anyone help me? Thanks!!

Try to use pyplot :

from matplotlib import pyplot as plt

plt.title("Title", fontdict = {'fontsize': 20})

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM