diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 2db82217acc4..adc01076f484 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -6103,6 +6103,10 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None, .. plot:: mpl_examples/statistics/histogram_demo_features.py """ + # Avoid shadowing the builtin. + bin_range = range + del range + def _normalize_input(inp, ename='input'): """Normalize 1 or 2d input into list of np.ndarray or a single 2D np.ndarray. @@ -6147,13 +6151,6 @@ def _normalize_input(inp, ename='input'): if bins is None: bins = rcParams['hist.bins'] - # xrange becomes range after 2to3 - bin_range = range - range = __builtins__["range"] - - # NOTE: the range keyword overwrites the built-in func range !!! - # needs to be fixed in numpy !!! - # Validate string inputs here so we don't have to clutter # subsequent code. if histtype not in ['bar', 'barstacked', 'step', 'stepfilled']: @@ -6514,10 +6511,7 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None, .. plot:: mpl_examples/statistics/plot_hist.py """ - # xrange becomes range after 2to3 - bin_range = range - range = __builtins__["range"] - h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=bin_range, + h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=range, normed=normed, weights=weights) if cmin is not None: