簡體   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