【发布时间】:2018-02-08 13:48:09
【问题描述】:
我希望 Pandas 图表中的每条条都具有不同的颜色。根据this post 和类似的解决方案看起来很简单。
当我尝试模拟该解决方案时,我最终会得到所有条的颜色相同(尽管与标准条的颜色不同)。我想我做错了什么,但我看不到它是什么。还有人看吗?
fig = df.plot(kind='bar', # Plot a bar chart
legend=False, # Turn the Legend off
width=0.75, # Set bar width as 75% of space available
figsize=(8,5.8), # Set size of plot in inches
colormap='Paired')
colormap='Paired' 是用来改变颜色的位。我明白了:
很好,但是所有的条都是相同的颜色!正如您在上面看到的,我正在对绘图进行其他更改,但它们都是文本格式或轴细节的删除。
【问题讨论】:
标签: pandas matplotlib plot