如何更改seaborn散点图中的专色边缘颜色? [英] how to change spot edge colors in seaborn scatter plots?
本文介绍了如何更改seaborn散点图中的专色边缘颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 seaborn 创建了一个散点图:
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)
原始数据(部分):
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
最后的情节是这样的:
我不喜欢斑点的白色边缘.图像的左下部分聚集了最多的斑点,看起来太白了.我已经在我的代码中包含了 edgecolors=None
但它似乎不起作用.有谁知道如何去除边缘颜色或将其更改为其他颜色?
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?
非常感谢!
推荐答案
用 linewidth=0
类似于:
g=sns.scatterplot(x="length", y="coverage", data=df, hue = 'Products',
linewidth=0, alpha = 0.7)
这篇关于如何更改seaborn散点图中的专色边缘颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文