Matplotlib绘制了矩阵
然后,我仅从矩阵
a
的每一列,其中有4列分别为蓝色、黄色、绿色和红色。
![enter image description here](https://istack.dev59.com/6R18h.webp)
a[:,1:4]
中绘制第二、三、四列。是否可能使Matplotlib忽略默认的蓝色,并从黄色开始(这样我的每条线都与前面的颜色相同)?
![enter image description here](https://istack.dev59.com/fOaFY.webp)
a = np.cumsum(np.cumsum(np.random.randn(7,4), axis=0), axis=1)
lab = np.array(["A","B","C","E"])
fig, ax = plt.subplots()
ax.plot(a)
ax.legend(labels=lab )
# plt.show()
fig, ax = plt.subplots()
ax.plot(a[:,1:4])
ax.legend(labels=lab[1:4])
plt.show()