简体   繁体   中英

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

在此处输入图片说明

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'

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)

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