Examples

In [1]:
import numpy as np
import pandas as pd
In [3]:
s = pd.Series([2, 4, 3])
s.plot.line()
Out[3]:
<matplotlib.axes._subplots.AxesSubplot at 0x9850748>

The following example shows the populations for some animals over the years.

In [4]:
df = pd.DataFrame({
   'goat': [22, 15, 470, 660, 1876],
   'cow': [5, 20, 240, 400, 2000]
}, index=[2014, 2015, 2016, 2017, 2018])
lines = df.plot.line()

An example with subplots, an array of axes is returned:

In [5]:
axes = df.plot.line(subplots=True)
type(axes)
Out[5]:
numpy.ndarray

The following example shows the relationship between both populations.

In [7]:
lines = df.plot.line(x='goat', y='cow')