line(self, x=None, y=None, **kwargs)
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:
A single color string referred to by name, RGB or RGBA code,
for instance 'red' or '#a98d19'.
A sequence of color strings referred to by name, RGB or RGBA
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.
Adictoftheform{columnname
A dict of the form {column name
Additional keyword arguments are documented in DataFrame.plot
.
An ndarray is returned with one matplotlib.axes.Axes
per column when subplots=True
.
Plot Series or DataFrame as lines.
matplotlib.pyplot.plot
Plot y versus x as lines and/or markers.
.. plot:: ('context', 'close-figs')
>>> s = pd.Series([1, 3, 2]) >>> s.plot.line() <AxesSubplot:ylabel='Density'>
.. plot:: ('context', 'close-figs')
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()
.. plot:: ('context', 'close-figs')
An example with subplots, so an array of axes is returned.
>>> axes = df.plot.line(subplots=True) >>> type(axes) <class 'numpy.ndarray'>
.. plot:: ('context', 'close-figs')
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"} ... )
.. plot:: ('context', 'close-figs')
The following example shows the relationship between both populations.
See :>>> lines = df.plot.line(x='pig', y='horse')
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them