matplotlib中的折线图

时间:2016-09-27 14:30:11

标签: pandas matplotlib

我正在使用谷歌图表绘制以下数据框。

Hour S1 S2  S3
1   174 0   811
2   166 0   221
3   213 1   1061

但是使用谷歌图表,我无法将其保存到文件中。只是想知道我是否可以在matplotlib折线图中绘制数据框。

任何帮助都将不胜感激。

2 个答案:

答案 0 :(得分:1)

pandas有图表方法,只需:

df.plot()

其中df是你的pandas数据帧

答案 1 :(得分:1)

matplotlib 1.5及以上版本支持data wkarg

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot('S1', 'S2', data=df)

或直接传入列作为输入

ax.plot(df['S1'])
相关问题