[英]Color on a scatter graph Python Matplotlib
I have two variables I want to plot on a scatter graph. 我想在散点图上绘制两个变量。 I want one variable to be displayed in blue and the other in red. 我希望一个变量以蓝色显示,另一个以红色显示。 I only just started using Python, and I am rather confused. 我才刚刚开始使用Python,我感到很困惑。
scatter
takes an argument color
which allows you to set the point color (hard to guess). scatter
采用参数color
,可让您设置点颜色(难以猜测)。
x = linspace(0,10)
y1 = randn(50)
y2 = randn(50)+10
scatter(x, y1, color='red')
scatter(x, y2, color='blue')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.