Sir*_*irC 2 python plot matplotlib pandas
我想获得我最后一个情节的颜色
ax = df.plot() 
df2.plot(ax=ax)
# how to get the color of this last plot, 
#the plot is a single timeseries, there is therefore a single color.
我知道如何在 中做到这一点matplotlib.pyplot,对于那些感兴趣的人,请参见此处,但我找不到在 Pandas 中做到这一点的方法。get_color()熊猫有什么表现吗?
你不能做同样的事情,DataFrame.plot因为它不像那样返回Line2D对象列表pyplot.plot。但ax.get_lines()将返回绘制在轴中的线条列表,以便您可以查看最后绘制的线条的颜色:
ax.get_lines()[-1].get_color()
| 归档时间: | 
 | 
| 查看次数: | 1923 次 | 
| 最近记录: |