使用colormap绘制大量数据框列

时间:2019-07-11 03:04:26

标签: python pandas matplotlib

在绘制大量列(> 50)时,我遇到一个问题,由于默认颜色的重复,很难区分系列。按照(https://pandas.pydata.org/pandas-docs/version/0.13.1/visualization.html)的指示,我尝试使用来自matplotlib的colormap= argument绘制数据,但是返回以下错误:

AttributeError: Unknown property colormap

我的代码很简单。

plt.plot(dfModel, linewidth=2.5, colormap='jet')

我希望自己的情节看起来像这样: Colormaps plot from matplotlib

2 个答案:

答案 0 :(得分:1)

您可以将熊猫的plotcmap选项一起使用,plt.plot而不是colormap也会如此:

df.plot(cmap='jet')

答案 1 :(得分:0)

使用cmap参数代替colormap

查看文档here

错误:

Unknown property xxxx

错误表示未定义属性或参数名称。