unstuck
unstuck

Reputation: 646

How do I change the plot size for a seaborn scatter plot?

I have probably tried all the solutions presented here, but none works.

How to increase the size of a scatter plot using Seaborn? And why does it have to be so complicated

plt.figure(figsize=(10, 8)) 
scatter_preco_area = sns.relplot(data = apartamentos,
                                 x = "Area", y = "Preco").set(title = "Relação entre área e preço")

Returns this (ignoring the figsize):

enter image description here

And this one:

scatter_preco_area = sns.relplot(data = apartamentos,
                                 x = "Area", y = "Preco").set(rc={'figure.figsize':(11.7,8.27)})

Returns the error:

AttributeError: 'AxesSubplot' object has no property 'rc'

Upvotes: 0

Views: 7658

Answers (1)

eyShin
eyShin

Reputation: 86

height and aspect arguments could be used to change plot size. This code may works:

sns.relplot(data = apartamentos, x = "Area", y = "Preco",
            height = 8, aspect = 1.25)

Upvotes: 1

Related Questions