how to change spot edge colors in seaborn scatter plots?

Steve Xu picture Steve Xu · Oct 24, 2018 · Viewed 11.6k times · Source

I have created a scatter plot using seaborn:

import seaborn as sns
sns.set(style="ticks", color_codes=True)
        
g=sns.scatterplot(x="length", y="coverage", data=df, hue = 'Products', edgecolors=None, alpha = 0.7)
g.set(yscale="log")
plt.xlabel("Length(bp)")
plt.ylabel("Coverage")
plt.legend(loc = 'lower right')
plt.savefig('ATN_plot.png',dpi = 600)

The original data(Partial):

contig  length  coverage    pathway Products
53  1230    2423    stigmatellin    Yes
58  1195    885 curacin Yes
65  1161    598 jamaicamide Yes
68  1159    8001    jamaicamide Yes
79  1113    1423    curacin Yes
105 1042    1106    stigmatellin    Yes
727 666 223 HSAF (heat stable antifungal factor)    Yes
787 655 37  curacin Yes
791 654 13  stigmatellin    Yes
798 652 49  stigmatellin    Yes
844 642 5774    jamaicamide Yes
89  1090    13  No  No
90  1089    10  No  No
91  1086    26  No  No
92  1080    16  No  No
93  1079    10  No  No
94  1079    13  No  No

And the final plot looks like this:

enter image description here

I don't like the white edge of the spots. The left bottom part of the image where most spots are accumulated looks too white. I already included edgecolors=None in my code but it seems not working. Does anyone know how to remove the edge color or change it to others?

Thank you very much!

Answer

Lucas picture Lucas · Oct 24, 2018

Replace edgecolors=None with linewidth=0

Something like:

g=sns.scatterplot(x="length", y="coverage", data=df, hue = 'Products', 
                  linewidth=0, alpha = 0.7)