From 54e8a3d94b22a174837e4adc7279527b05e7e468 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 29 Jun 2019 15:54:24 +0200 Subject: [PATCH] Backport PR #14604: Update hist() docstring following removal of normed kwarg. --- lib/matplotlib/axes/_axes.py | 42 +++++++++++++++--------------------- lib/matplotlib/pyplot.py | 2 +- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 1536b681a116..f3d50b167e17 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -6431,7 +6431,7 @@ def clabel(self, CS, *args, **kwargs): #### Data analysis @_preprocess_data(replace_names=["x", 'weights'], label_namer="x") - def hist(self, x, bins=None, range=None, density=None, weights=None, + def hist(self, x, bins=None, range=None, density=False, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, color=None, label=None, stacked=False, normed=None, @@ -6504,11 +6504,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None, number of observations. If *stacked* is also ``True``, the sum of the histograms is normalized to 1. - Default is ``None`` for both *normed* and *density*. If either is - set, then that value will be used. If neither are set, then the - args will be treated as ``False``. - - If both *density* and *normed* are set an error is raised. + Default is ``False``. weights : (n, ) array_like or None, optional An array of weights, of the same shape as *x*. Each value in *x* @@ -6528,15 +6524,18 @@ def hist(self, x, bins=None, range=None, density=None, weights=None, (or you may alternatively use `~.bar()`). - cumulative : bool, optional + cumulative : bool or -1, optional If ``True``, then a histogram is computed where each bin gives the counts in that bin plus all bins for smaller values. The last bin - gives the total number of datapoints. If *normed* or *density* - is also ``True`` then the histogram is normalized such that the - last bin equals 1. If *cumulative* evaluates to less than 0 - (e.g., -1), the direction of accumulation is reversed. - In this case, if *normed* and/or *density* is also ``True``, then - the histogram is normalized such that the first bin equals 1. + gives the total number of datapoints. + + If *density* is also ``True`` then the histogram is normalized such + that the last bin equals 1. + + If *cumulative* is a number less than 0 (e.g., -1), the direction + of accumulation is reversed. In this case, if *density* is also + ``True``, then the histogram is normalized such that the first bin + equals 1. Default is ``False`` @@ -6553,26 +6552,19 @@ def hist(self, x, bins=None, range=None, density=None, weights=None, - 'bar' is a traditional bar-type histogram. If multiple data are given the bars are arranged side by side. - - 'barstacked' is a bar-type histogram where multiple data are stacked on top of each other. - - - 'step' generates a lineplot that is by default - unfilled. - - - 'stepfilled' generates a lineplot that is by default - filled. + - 'step' generates a lineplot that is by default unfilled. + - 'stepfilled' generates a lineplot that is by default filled. Default is 'bar' align : {'left', 'mid', 'right'}, optional Controls how the histogram is plotted. - - 'left': bars are centered on the left bin edges. - - - 'mid': bars are centered between the bin edges. - - - 'right': bars are centered on the right bin edges. + - 'left': bars are centered on the left bin edges. + - 'mid': bars are centered between the bin edges. + - 'right': bars are centered on the right bin edges. Default is 'mid' diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index ce66bd894838..b288f21c4e6a 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -2629,7 +2629,7 @@ def hexbin( # Autogenerated by boilerplate.py. Do not edit as changes will be lost. @docstring.copy(Axes.hist) def hist( - x, bins=None, range=None, density=None, weights=None, + x, bins=None, range=None, density=False, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, color=None, label=None, stacked=False, normed=None, *, data=None,
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: