Series.plot.line(self, x=None, y=None, **kwargs)
[source]
Plot Series or DataFrame as lines.
This function is useful to plot lines using DataFrame’s values as coordinates.
Parameters: |
|
---|---|
Returns: |
|
See also
matplotlib.pyplot.plot
>>> s = pd.Series([1, 3, 2]) >>> s.plot.line()
The following example shows the populations for some animals over the years.
>>> df = pd.DataFrame({ ... 'pig': [20, 18, 489, 675, 1776], ... 'horse': [4, 25, 281, 600, 1900] ... }, index=[1990, 1997, 2003, 2009, 2014]) >>> lines = df.plot.line()
An example with subplots, so an array of axes is returned.
>>> axes = df.plot.line(subplots=True) >>> type(axes) <class 'numpy.ndarray'>
The following example shows the relationship between both populations.
>>> lines = df.plot.line(x='pig', y='horse')
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Series.plot.line.html