【发布时间】:2017-09-14 21:34:42
【问题描述】:
我有一个要制作散点图的数据框。
数据框看起来像:
year length Animation
0 1971 121 1
1 1939 71 1
2 1941 7 0
3 1996 70 1
4 1975 71 0
我希望散点图中的点具有不同的颜色,具体取决于动画行中的值。
所以动画 = 1 = 黄色
动画 = 0 = 黑色
或者类似的东西
我尝试了以下操作:
dfScat = df[['year','length', 'Animation']]
dfScat = dfScat.loc[dfScat.length < 200]
axScat = dfScat.plot(kind='scatter', x=0, y=1, alpha=1/15, c=2)
【问题讨论】:
标签: python pandas matplotlib plot