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.
问问题
3472 次
2 回答
3
scatter
接受一个color
允许您设置点颜色的参数(很难猜到)。
x = linspace(0,10)
y1 = randn(50)
y2 = randn(50)+10
scatter(x, y1, color='red')
scatter(x, y2, color='blue')
于 2012-10-30T13:05:05.600 回答
1
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(10)
y = x
z = x*2
plt.scatter(x,y,c="r")
plt.scatter(x,z,c="b")
plt.show()
阅读本文和 matplotlib 文档。
于 2012-10-30T13:01:38.153 回答