How to increase the title font of a Seaborn.displot chart?

Asked

Viewed 32 times

-1

Hello! I have the following 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()

The result obtained is this:

Output

I have tried several different commands that I find in the Aboraborn documentation to increase the title source, such as fontsize or font_scale, but to no avail.

Can anyone help me? Thanks in advance!

EDITED:

I got it through the plt command.title:

f = sns.displot(df,x="yearOfRegistration", kde=True, binwidth=5) 
plt.title("Distribuição de Veículos com base no Ano de Registro", fontdict = {'fontsize': 14})
f.set_axis_labels("Ano de Registro","Densidade (KDE)")
plt.show()

Seaborn.displot apparently has no argument to increase the title.

2 answers

0

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

plt.show()

Did you come put a fontsize in the set method? , it presents some error or just doesn’t work??

Test with this my code I modified, please. I think the error is in only your set in the second line

0

I got help on stackoverflow in English. Follow the code below:

f = sns.displot(df,x="yearOfRegistration", kde=True, binwidth=5)
plt.title("Distribuição de Veículos com base no Ano de Registro", fontdict = {'fontsize': 14})
f.set_axis_labels("Ano de Registro","Densidade (KDE)")

plt.show()

The difficulty was in using Seaborn.displot. With pyplot.title solves.

I thank everyone who replied!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.