繁体   English   中英

如何在Seaborn的relplot上更改散点大小(seaborn.relplot不是regplot)? Seaborn 0.9.0

[英]How to change scatter point size on Seaborn's relplot (seaborn.relplot not regplot)? Seaborn 0.9.0

下面的代码可以绘制,但是分散点太大。

sns.relplot(x='columnx', y='columny', hue='cluster', data=df)

我想更改分散点的大小。 这些情节都没有。

sns.relplot(x='columnx', y='columny', hue='cluster', scatter_kws={'s':.01}, data=df)

sns.relplot(x='tmmx', y='NDVI', hue='cluster', kwargs={'s':.01}, data=df)

Seaborn文档说:

kwargs:键,值配对

 Other keyword arguments are passed through to the underlying plotting function. 

我相信“底层绘图功能”是seaborn.scatterplot(),它表示:

kwargs:键,值映射

 Other keyword arguments are passed down to plt.scatter at draw time. 

要创建df,请执行以下操作:

d = {'columnx': [1, 2, 3,], 'columny':[2,4,5], 'cluster':[0,1,0]}

df = pd.DataFrame(data=df)

由于基础函数是matplotlib.pyplot.scatter(x, y, s=None) ,因此将s = None填充为合适的整数会更改所有点的大小。

给定您的数据和问题,请在1到更大的数字之间选择大小,并使用上述s参数找出最适合您的参数。 只是更加清楚最终代码的外观。

sns.relplot(
    x='columnx', y='columny', hue='cluster', data=df, s=10)

暂无
暂无

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

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