Make plots of Series or DataFrame.
Uses the backend specified by the option plotting.backend
. By default, matplotlib is used.
The object for which the method is called.
Only used if data is a DataFrame.
Allows plotting of one column versus another. Only used if data is a DataFrame.
The kind of plot to produce:
â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 (DataFrame only)
âhexbinâ : hexbin plot (DataFrame only)
An axes of the current figure.
Whether to group columns into subplots:
False
: No subplots will be used
True
: Make separate subplots for each column.
sequence of iterables of column labels: Create a subplot for each group of columns. For example [(âaâ, âcâ), (âbâ, âdâ)] will create 2 subplots: one with columns âaâ and âcâ, and one with columns âbâ and âdâ. Remaining columns that arenât specified will be plotted in additional subplots (one per column).
Added in version 1.5.0.
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 an ax is passed in; Be aware, that passing in both an ax and sharex=True
will alter all x axis labels for all axis in a figure.
In case subplots=True
, share y axis and set some y axis labels to invisible.
(rows, columns) for the layout of subplots.
Size of a figure object.
Use index as ticks for x axis.
Title to use for the plot. If a string is passed, print the string at the top of the figure. If a list is passed and subplots is True, print each item in the list above the corresponding subplot.
Axis grid lines.
Place legend on axis subplots.
The matplotlib line style per column.
Use log scaling or symlog scaling on x axis.
Use log scaling or symlog scaling on y axis.
Use log scaling or symlog scaling on both x and y axes.
Values to use for the xticks.
Values to use for the yticks.
Set the x limits of the current axes.
Set the y limits of the current axes.
Name to use for the xlabel on x-axis. Default uses index name as xlabel, or the x-column name for planar plots.
Changed in version 2.0.0: Now applicable to histograms.
Name to use for the ylabel on y-axis. Default will show no ylabel, or the y-column name for planar plots.
Changed in version 2.0.0: Now applicable to histograms.
Rotation for ticks (xticks for vertical, yticks for horizontal plots).
Font size for xticks and yticks.
Colormap to select colors from. If string, load colormap with that name from matplotlib.
If True, plot colorbar (only relevant for âscatterâ and âhexbinâ plots).
Specify relative alignments for bar plot layout. From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center).
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.
See Plotting with Error Bars for detail.
Equivalent to yerr.
If True, create stacked plot.
Whether to plot on the secondary y-axis if a list/tuple, which columns to plot on secondary y-axis.
When using a secondary_y axis, automatically mark the column labels with â(right)â in the legend.
If True, boolean values can be plotted.
Backend to use instead of the backend specified in the option plotting.backend
. For instance, âmatplotlibâ. Alternatively, to specify the plotting.backend
for the whole session, set pd.options.plotting.backend
.
Options to pass to matplotlib plotting method.
matplotlib.axes.Axes
or numpy.ndarray of them
If the backend is not the default matplotlib one, the return value will be the object returned by the backend.
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)
Examples
For Series:
>>> ser = pd.Series([1, 2, 3, 3]) >>> plot = ser.plot(kind='hist', title="My plot")
For DataFrame:
>>> df = pd.DataFrame({'length': [1.5, 0.5, 1.2, 0.9, 3], ... 'width': [0.7, 0.2, 0.15, 0.2, 1.1]}, ... index=['pig', 'rabbit', 'duck', 'chicken', 'horse']) >>> plot = df.plot(title="DataFrame Plot")
For SeriesGroupBy:
>>> lst = [-1, -2, -3, 1, 2, 3] >>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst) >>> plot = ser.groupby(lambda x: x > 0).plot(title="SeriesGroupBy Plot")
For DataFrameGroupBy:
>>> df = pd.DataFrame({"col1" : [1, 2, 3, 4], ... "col2" : ["A", "B", "A", "B"]}) >>> plot = df.groupby("col2").plot(kind="bar", title="DataFrameGroupBy Plot")
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