[英]How to change scatter point size on Seaborn's relplot (seaborn.relplot not regplot)? Seaborn 0.9.0
The code below plots, however the scatter points are too large. 下面的代码可以绘制,但是分散点太大。
sns.relplot(x='columnx', y='columny', hue='cluster', data=df)
I would like to change the size of the scatter points. 我想更改分散点的大小。 Neither of these plot.
这些情节都没有。
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 Documentation says: Seaborn文档说:
kwargs : key, value pairings
kwargs:键,值配对
Other keyword arguments are passed through to the underlying plotting function.
I believe the 'underlying plotting function' is seaborn.scatterplot(), which says: 我相信“底层绘图功能”是seaborn.scatterplot(),它表示:
kwargs : key, value mappings
kwargs:键,值映射
Other keyword arguments are passed down to plt.scatter at draw time.
To create a df: 要创建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填充为合适的整数会更改所有点的大小。
Given your data and question choose your size between 1 and some larger number and figure out what works for you with the s argument as mentioned above. 给定您的数据和问题,请在1到更大的数字之间选择大小,并使用上述s参数找出最适合您的参数。 Just being more clear on how the end code should look.
只是更加清楚最终代码的外观。
sns.relplot(
x='columnx', y='columny', hue='cluster', data=df, s=10)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.