I have dataframe total_year
, which contains three columns (year
, action
, comedy
).
How can I plot two columns (action
and comedy
) on y-axis?
My code plots only one:
total_year[-15:].plot(x='year', y='action', figsize=(10,5), grid=True)
Pandas.DataFrame.plot()
per default uses index for plotting X
axis, all other numeric columns will be used as Y
values.
So setting year
column as index will do the trick:
total_year.set_index('year').plot(figsize=(10,5), grid=True)