Plot Series or DataFrame as lines.
This function is useful to plot lines using DataFrameâs values as coordinates.
Allows plotting of one column versus another. If not specified, the index of the DataFrame is used.
Allows plotting of one column versus another. If not specified, all numerical columns are used.
The color for each of the DataFrameâs columns. Possible values are:
for instance âredâ or â#a98d19â.
code, which will be used for each column recursively. For instance [âgreenâ,âyellowâ] each columnâs line will be filled in green or yellow, alternatively. If there is only a single column to be plotted, then only the first color from the color list will be used.
colored accordingly. For example, if your columns are called a and b, then passing {âaâ: âgreenâ, âbâ: âredâ} will color lines for column a in green and lines for column b in red.
Additional keyword arguments are documented in DataFrame.plot()
.
An ndarray is returned with one matplotlib.axes.Axes
per column when subplots=True
.
Examples
>>> 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'>
Letâs repeat the same example, but specifying colors for each column (in this case, for each animal).
>>> axes = df.plot.line( ... subplots=True, color={"pig": "pink", "horse": "#742802"} ... )
The following example shows the relationship between both populations.
>>> lines = df.plot.line(x='pig', y='horse')
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4