Pandas. Dataframe.plot

Source: Internet
Author: User

Pandas. Dataframe.plot¶
DataFrame. plot ( x=none, y=none, kind= ' line ', ax=none, subplots=false, sharex=none, sharey=false, layout=none, figsize=none, use_index=true Title=none, grid=none, legend=true, style=none, logx=false< /c17>, logy=false, loglog=false, xticks=none, yticks=none, Xlim =none, ylim=none, rot=none, fontsize=none, colormap=none, table=false, yerr=none, xerr=none, secondary_y=false, SORT_COLUMNS=FA LSE, **kwds

Make plots of DataFrame using Matplotlib/pylab.

New in version 0.17.0: Each plot kind have a corresponding method on the dataframe.plot accessor: df.plot (kind= "line") is Equiva Lent to Df.plot.line ().

Parameters:

Data : DataFrame

x : label or position, default None

y : label or position, default None

Allows plotting of one column versus another

Kind : str

  • "Line": Line plot (default)
  • ' Bar ': Vertical bar plot
  • ' Barh ': Horizontal bar plot
  • ' hist ': Histogram
  • ' Box ': BoxPlot
  • ' KDE ': Kernel Density estimation plot
  • ' Density ': Same as ' KDE '
  • ' Area ': Area plot
  • ' Pie ': Pie plot
  • ' Scatter ': scatter plot
  • ' Hexbin ': Hexbin plot

ax : Matplotlib axes object, default None

subplots : boolean, default False

Make separate subplots for each column

Sharex : boolean, default True if Ax is None else False

In case subplots=true, share x axis and set some x axis labels to invisible; Defaults to True if AX is None otherwise False if a ax is passed in; Be aware, which passing in both an ax and sharex=true would alter all x axis labels for all axis in a figure!

Sharey : boolean, default False

In case subplots=true, share Y axis and set some Y axis labels to invisible

layout : tuple (optional)

(Rows, columns) for the layout of subplots

figsize : A tuple (width, height) in inches

Use_index : boolean, default True

Use index as ticks for x axis

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

style : List or Dict

Matplotlib Line style per column

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 (xticks to vertical, yticks for horizontal plots)

fontsize : int, default None

Font size for Xticks and yticks

colormap : str or matplotlib ColorMap object, default None

Colormap to select colors from. If string, load ColorMap with the. Name from Matplotlib.

Colorbar : boolean, optional

If True, Plot colorbar (only relevant for ' scatter ' and ' hexbin ' plots)

position : float

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

layout : tuple (optional)

(Rows, columns) for the layout of the plot

Table : boolean, Series or DataFrame, default False

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

yerr : DataFrame, Series, Array-like, Dict and str

See plotting with Error Bars for detail.

xerr : Same types as Yerr.

Stacked : boolean, default False in line and

Bar plots, and True in area plot. If True, create stacked plot.

sort_columns : boolean, default False

Sort column names to determine plot ordering

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, automatically mark the column labels with "[Right]" in the legend

kwds : Keywords

Options to pass to Matplotlib plotting method

Returns:

axes : matplotlib. Axessubplot or Np.array of them

Notes

  • See matplotlib documentation online for more on this subject
  • If Kind = ' bar ' or ' Barh ', you can specify relative alignments for bar plot layout by position keyword. from 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center)
  • If Kind = ' scatter ' and the argument C is the name of a dataframe column, the values of Used to color.
  • If Kind = ' hexbin ', you can control the size of the bins with the gridsize argument. By default, a histogram of the counts around all (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 all (x, y) Point and reduce_c_function is a function of one argument That reduces all the values of a bin to a single number (e.g. mean, Max, sum, std) .
    • Index
    • Modules |
    • Next |
    • Previous |
    • Pandas 0.18.1 documentation»
    • API reference»

Pandas. Dataframe.plot

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.