From 0d86742f6bc4a3ae4934e51b8bc3e67eea19523c Mon Sep 17 00:00:00 2001 From: Antonio Molina Date: Sun, 11 Mar 2018 18:57:37 +0100 Subject: [PATCH] DOC: Improved pandas.plotting.bootstrap_plot docstring (#20166) * Improved documentation on bootstrap_plot * Improved documentation on bootstrap_plot * Doc bootstrap_plot: Fixed some comments on pull requests * Added reference to wikipedia * Changed kwds for **kwds * Removed ** from kwds becuase of validation iuses * Fixed forgotten break line. I think that the kwds paramater now fits what expected @TomAugspurger. If not, sorry and indicate how it should be * Fixed warnings on compilation * Moved reference to extended description --- pandas/plotting/_misc.py | 47 +++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 03a06169d46bc..150c9274d4e5c 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -364,20 +364,51 @@ def f(t): def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds): - """Bootstrap plot. + """ + Bootstrap plot on mean, median and mid-range statistics. + + The bootstrap plot is used to estimate the uncertainty of a statistic + by relaying on random sampling with replacement [1]_. This function will + generate bootstrapping plots for mean, median and mid-range statistics + for the given number of samples of the given size. + + .. [1] "Bootstrapping (statistics)" in \ + https://en.wikipedia.org/wiki/Bootstrapping_%28statistics%29 Parameters ---------- - series: Time series - fig: matplotlib figure object, optional - size: number of data points to consider during each sampling - samples: number of times the bootstrap procedure is performed - kwds: optional keyword arguments for plotting commands, must be accepted - by both hist and plot + series : pandas.Series + Pandas Series from where to get the samplings for the bootstrapping. + fig : matplotlib.figure.Figure, default None + If given, it will use the `fig` reference for plotting instead of + creating a new one with default parameters. + size : int, default 50 + Number of data points to consider during each sampling. It must be + greater or equal than the length of the `series`. + samples : int, default 500 + Number of times the bootstrap procedure is performed. + **kwds : + Options to pass to matplotlib plotting method. Returns ------- - fig: matplotlib figure + fig : matplotlib.figure.Figure + Matplotlib figure + + See Also + -------- + pandas.DataFrame.plot : Basic plotting for DataFrame objects. + pandas.Series.plot : Basic plotting for Series objects. + + Examples + -------- + + .. plot:: + :context: close-figs + + >>> import numpy as np + >>> s = pd.Series(np.random.uniform(size=100)) + >>> fig = pd.plotting.bootstrap_plot(s) """ import random import matplotlib.pyplot as plt