Colors matplotlib:打印并获取颜色?

Colors matplotlib:打印并获取颜色?,colors,matplotlib,Colors,Matplotlib,是否可以获得绘图中使用的颜色列表? 考虑这个例子: line1 = ax1.plot(x1,y1) line2 = ax1.plot(x2,y2) 我现在知道如何设置颜色了 plt.setp(line1,'color','red') plt.setp(line2,'color','red') 但是有没有办法知道使用了什么颜色?plt.getp(第1行,'color')不起作用,并抱怨 AttributeError: 'list' object has no attribute 'get_co

是否可以获得绘图中使用的颜色列表? 考虑这个例子:

line1 = ax1.plot(x1,y1)
line2 = ax1.plot(x2,y2)
我现在知道如何设置颜色了

plt.setp(line1,'color','red')
plt.setp(line2,'color','red')
但是有没有办法知道使用了什么颜色?plt.getp(第1行,'color')不起作用,并抱怨

AttributeError: 'list' object has no attribute 'get_color'

好的,找到了答案:plot()调用返回一个行列表。查询颜色的正确方法是

print line1[0].get_color()