From 7eee4c22e3021aa4b0c96b54cedbddaae70d44a7 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 18 Mar 2017 13:33:56 -0700 Subject: [PATCH] Don't index into __builtins__ (not supported by PyPy). --- lib/matplotlib/axes/_axes.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) 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: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy