user3447653
user3447653

Reputation: 4148

Line graphs in matplotlib

I am plotting the below data frame using google charts.

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

But with google charts, I am not able to save it to a file. Just wondering whether I can plot the dataframe in matplotlib line charts.

Any help would be appreciated.

Upvotes: 1

Views: 112

Answers (2)

tacaswell
tacaswell

Reputation: 87376

matplotlib 1.5 and above supports a data wkarg

import matplotlib.pyplot as plt

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

or just directly pass in the columns as input

ax.plot(df['S1'])

Upvotes: 1

Steven G
Steven G

Reputation: 17122

pandas has charting method, just do:

df.plot()

where df is your pandas dataframe

Upvotes: 1

Related Questions