简体   繁体   English

如何更改 seaborn 散点图的绘图大小?

[英]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?如何使用 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):返回这个(忽略 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. heightaspect参数可用于更改绘图大小。 This code may works:此代码可能有效:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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