how to change spot edge colors in seaborn scatter plots?
In matplotlib, most arguments take None
as in "use the default". Whereas here you do not want to use the default, but instead no edgecolor. This is done via "none"
.
sns.scatterplot(..., edgecolor="none")
You can change spot color by passing kwargs (keyword arguments)
kwargs = {'edgecolor':"r", # for edge color
'linewidth':2.7, # line width of spot
'linestyle':'--', # line style of spot
}
sns.scatterplot(x = "tip", y = "total_bill", data = tips_df, hue = "sex",
size ="sex", sizes = (100, 300), palette = "nipy_spectral" ,**kwargs)
or you can pass it directly as a parameters, like:
sns.scatterplot(x = "tip", y = "total_bill", data = tips_df, hue = "sex",
size ="sex", sizes = (100, 300), palette = "nipy_spectral",
edgecolor='r',
linewidth=2,
linestyle='--',)
Output >>>
I hope, I have clear your doubt.
Replace edgecolors=None
with linewidth=0
Something like:
g=sns.scatterplot(x="length", y="coverage", data=df, hue = 'Products',
linewidth=0, alpha = 0.7)