简体   繁体   English

seaborn 散点图的调色板不起作用

[英]Color palette of seaborn scatterplot is not working

I am trying to use the sequential colour brewer palette of seaborn scatter plot, but it does not work properly.我正在尝试使用 seaborn 散点图的顺序颜色 brewer 调色板,但它无法正常工作。 This is what I have done so far.这是我迄今为止所做的。 I would appreciate any help.我将不胜感激任何帮助。

y = [randrange(100) for i in range(50)]
x = [i for i in range(50)]
ax = sns.scatterplot(x, y, s=15, c=y, palette=sns.color_palette("YlOrBr", as_cmap=True))
plt.tight_layout()
plt.show()

Thanks in advance!提前致谢!

palettehue ,因此将c更改为hue

ax = sns.scatterplot(x, y, s=15, hue=y, palette="YlOrBr", legend=False)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM