pandas.DataFrame.plot

DataFrame.plot(frame=None, x=None, y=None, subplots=False, sharex=True, sharey=False, use_index=True, figsize=None, grid=None, legend=True, rot=None, ax=None, style=None, title=None, xlim=None, ylim=None, logx=False, logy=False, xticks=None, yticks=None, kind='line', sort_columns=False, fontsize=None, secondary_y=False, **kwds)

Make line, bar, or scatter plots of DataFrame series with the index on the x-axis using matplotlib / pylab.

Parameters :

frame : DataFrame

x : label or position, default None

y : label or position, default None

Allows plotting of one column versus another

yerr : DataFrame (with matching labels), Series, list-type (tuple, list,

ndarray), or str of column name containing y error values

xerr : similar functionality as yerr, but for x error values

subplots : boolean, default False

Make separate subplots for each time series

sharex : boolean, default True

In case subplots=True, share x axis

sharey : boolean, default False

In case subplots=True, share y axis

use_index : boolean, default True

Use index as ticks for x axis

stacked : boolean, default False

If True, create stacked bar plot. Only valid for DataFrame input

sort_columns: boolean, default False

Sort column names to determine plot ordering

title : string

Title to use for the plot

grid : boolean, default None (matlab style default)

Axis grid lines

legend : False/True/’reverse’

Place legend on axis subplots

ax : matplotlib axis object, default None

style : list or dict

matplotlib line style per column

kind : {‘line’, ‘bar’, ‘barh’, ‘kde’, ‘density’, ‘area’, scatter’, ‘hexbin’}

line : line plot bar : vertical bar plot barh : horizontal bar plot kde/density : Kernel Density Estimation plot area : area plot scatter : scatter plot hexbin : hexbin plot

logx : boolean, default False

Use log scaling on x axis

logy : boolean, default False

Use log scaling on y axis

loglog : boolean, default False

Use log scaling on both x and y axes

xticks : sequence

Values to use for the xticks

yticks : sequence

Values to use for the yticks

xlim : 2-tuple/list

ylim : 2-tuple/list

rot : int, default None

Rotation for ticks

secondary_y : boolean or sequence, default False

Whether to plot on the secondary y-axis If a list/tuple, which columns to plot on secondary y-axis

mark_right: boolean, default True

When using a secondary_y axis, should the legend label the axis of the various columns automatically

colormap : str or matplotlib colormap object, default None

Colormap to select colors from. If string, load colormap with that name from matplotlib.

position : float

Specify relative alignments for bar plot layout. From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center)

table : boolean, Series or DataFrame, default False

If True, draw a table using the data in the DataFrame and the data will be transposed to meet matplotlib’s default layout. If a Series or DataFrame is passed, use passed data to draw a table.

kwds : keywords

Options to pass to matplotlib plotting method

Returns :

ax_or_axes : matplotlib.AxesSubplot or list of them

Notes

If kind`=’hexbin’, you can control the size of the bins with the `gridsize argument. By default, a histogram of the counts around each (x, y) point is computed. You can specify alternative aggregations by passing values to the C and reduce_C_function arguments. C specifies the value at each (x, y) point and reduce_C_function is a function of one argument that reduces all the values in a bin to a single number (e.g. mean, max, sum, std).