Skip to content

DOC: Improve docs for plotting #48437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def hist_frame(

Parameters
----------
%(data)s\
column : str or list of str, optional
Column name or list of names, or vector.
Can be any valid input to :meth:`pandas.DataFrame.groupby`.
Expand All @@ -276,7 +277,7 @@ def hist_frame(
The matplotlib axes to be used by boxplot.
fontsize : float or str
Tick label font size in points or as a string (e.g., `large`).
rot : int or float, default 0
rot : float, default 0
The rotation angle of labels (in degrees)
with respect to the screen coordinate system.
grid : bool, default True
Expand Down Expand Up @@ -466,7 +467,7 @@ def hist_frame(
"""


@Substitution(backend="")
@Substitution(data="data : DataFrame\n The data to visualize.\n", backend="")
@Appender(_boxplot_doc)
def boxplot(
data: DataFrame,
Expand Down Expand Up @@ -497,7 +498,7 @@ def boxplot(
)


@Substitution(backend=_backend_doc)
@Substitution(data="", backend=_backend_doc)
@Appender(_boxplot_doc)
def boxplot_frame(
self,
Expand Down Expand Up @@ -556,7 +557,7 @@ def boxplot_frame_groupby(

column : column name or list of names, or vector
Can be any valid input to groupby.
fontsize : int or str
fontsize : float or str
rot : label rotation angle
grid : Setting this to True will show the grid
ax : Matplotlib axis object, default None
Expand Down Expand Up @@ -730,10 +731,10 @@ class PlotAccessor(PandasObject):

Now applicable to planar plots (`scatter`, `hexbin`).

rot : int, default None
rot : float, default None
Rotation for ticks (xticks for vertical, yticks for horizontal
plots).
fontsize : int, default None
fontsize : float, 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 that
Expand Down
2 changes: 1 addition & 1 deletion pandas/plotting/_matplotlib/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def _grouped_hist(
layout : optional
sharex : bool, default False
sharey : bool, default False
rot : int, default 90
rot : float, default 90
grid : bool, default True
legend: : bool, default False
kwargs : dict, keyword arguments passed to matplotlib.Axes.hist
Expand Down
39 changes: 23 additions & 16 deletions pandas/plotting/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)


def table(ax, data, rowLabels=None, colLabels=None, **kwargs):
def table(ax, data, **kwargs):
"""
Helper function to convert DataFrame and Series to matplotlib.table.

Expand Down Expand Up @@ -285,14 +285,18 @@ def andrews_curves(
----------
frame : DataFrame
Data to be plotted, preferably normalized to (0.0, 1.0).
class_column : Name of the column containing class names
ax : matplotlib axes object, default None
samples : Number of points to plot in each curve
color : list or tuple, optional
Colors to use for the different classes.
class_column : label
Name of the column containing class names.
ax : axes object, default None
Axes to use.
samples : int
Number of points to plot in each curve.
color : str, list[str] or tuple[str], optional
Colors to use for the different classes. Colors can be strings
or 3-element floating point RBG values.
colormap : str or matplotlib colormap object, default None
Colormap to select colors from. If string, load colormap with that name
from matplotlib.
Colormap to select colors from. If a string, load colormap with that
name from matplotlib.
**kwargs
Options to pass to matplotlib plotting method.

Expand Down Expand Up @@ -430,7 +434,7 @@ def parallel_coordinates(

Returns
-------
class:`matplotlib.axis.Axes`
matplotlib.axis.Axes

Examples
--------
Expand Down Expand Up @@ -470,19 +474,21 @@ def lag_plot(series: Series, lag: int = 1, ax: Axes | None = None, **kwds) -> Ax

Parameters
----------
series : Time series
lag : lag of the scatter plot, default 1
series : Series
The time series to visualize.
lag : int, default 1
Lag length of the scatter plot.
ax : Matplotlib axis object, optional
The matplotlib axis object to use.
**kwds
Matplotlib scatter method keyword arguments.

Returns
-------
class:`matplotlib.axis.Axes`
matplotlib.axis.Axes

Examples
--------

Lag plots are most commonly used to look for patterns in time series data.

Given the following time series
Expand Down Expand Up @@ -514,18 +520,19 @@ def autocorrelation_plot(series: Series, ax: Axes | None = None, **kwargs) -> Ax

Parameters
----------
series : Time series
series : Series
The time series to visualize.
ax : Matplotlib axis object, optional
The matplotlib axis object to use.
**kwargs
Options to pass to matplotlib plotting method.

Returns
-------
class:`matplotlib.axis.Axes`
matplotlib.axis.Axes

Examples
--------

The horizontal lines in the plot correspond to 95% and 99% confidence bands.

The dashed line is 99% confidence band.
Expand Down