From 3a299286da776773982f26ae3ac18f5fdfd81921 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 12 Nov 2019 17:49:11 +0100 Subject: [PATCH] Bump numpy dependency to >=1.15. --- INSTALL.rst | 2 +- doc/api/next_api_changes/development.rst | 2 +- lib/matplotlib/__init__.py | 2 +- lib/matplotlib/axes/_axes.py | 28 ++---------------------- requirements/testing/travis36minver.txt | 2 +- setup.py | 4 ++-- 6 files changed, 8 insertions(+), 32 deletions(-) diff --git a/INSTALL.rst b/INSTALL.rst index d39638f24ab7..88f5800166fd 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -108,7 +108,7 @@ Dependencies Matplotlib requires the following dependencies: * `Python `_ (>= 3.6) -* `NumPy `_ (>= 1.12) +* `NumPy `_ (>= 1.15) * `setuptools `_ * `cycler `_ (>= 0.10.0) * `dateutil `_ (>= 2.1) diff --git a/doc/api/next_api_changes/development.rst b/doc/api/next_api_changes/development.rst index 25b063d98965..9fa11e8a484a 100644 --- a/doc/api/next_api_changes/development.rst +++ b/doc/api/next_api_changes/development.rst @@ -1,7 +1,7 @@ Development changes ------------------- -Matplotlib now requires numpy>=1.12 +Matplotlib now requires numpy>=1.15 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Matplotlib now uses Pillow to save and read pngs diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index f3a9bc6d8c6e..c6bc77bf6550 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -194,7 +194,7 @@ def _check_versions(): ("cycler", "0.10"), ("dateutil", "2.1"), ("kiwisolver", "1.0.1"), - ("numpy", "1.12"), + ("numpy", "1.15"), ("pyparsing", "2.0.1"), ]: module = importlib.import_module(modname) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index b4d496cdbaff..5ec142df7026 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -35,30 +35,6 @@ from matplotlib.axes._secondary_axes import SecondaryAxis from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer -try: - from numpy.lib.histograms import ( - histogram_bin_edges as _histogram_bin_edges) -except ImportError: - # this function is new in np 1.15 - def _histogram_bin_edges(arr, bins, range=None, weights=None): - # this in True for 1D arrays, and False for None and str - if np.ndim(bins) == 1: - return bins - - if isinstance(bins, str): - # rather than backporting the internals, just do the full - # computation. If this is too slow for users, they can - # update numpy, or pick a manual number of bins - return np.histogram(arr, bins, range, weights)[1] - else: - if bins is None: - # hard-code numpy's default - bins = 10 - if range is None: - range = np.min(arr), np.max(arr) - - return np.linspace(*range, bins + 1) - _log = logging.getLogger(__name__) @@ -6698,8 +6674,8 @@ def hist(self, x, bins=None, range=None, density=False, weights=None, _w = np.concatenate(w) else: _w = None - - bins = _histogram_bin_edges(np.concatenate(x), bins, bin_range, _w) + bins = np.histogram_bin_edges( + np.concatenate(x), bins, bin_range, _w) else: hist_kwargs['range'] = bin_range diff --git a/requirements/testing/travis36minver.txt b/requirements/testing/travis36minver.txt index 7d35b618b784..2cc084fbce19 100644 --- a/requirements/testing/travis36minver.txt +++ b/requirements/testing/travis36minver.txt @@ -2,5 +2,5 @@ cycler==0.10 python-dateutil==2.1 -numpy==1.12.0 +numpy==1.15.0 pyparsing==2.0.1 diff --git a/setup.py b/setup.py index 86795370dddd..eb009c0785ce 100644 --- a/setup.py +++ b/setup.py @@ -255,12 +255,12 @@ def run(self): python_requires='>={}'.format('.'.join(str(n) for n in min_version)), setup_requires=[ - "numpy>=1.12", + "numpy>=1.15", ], install_requires=[ "cycler>=0.10", "kiwisolver>=1.0.1", - "numpy>=1.12", + "numpy>=1.15", "pillow>=6.2.0", "pyparsing>=2.0.1,!=2.0.4,!=2.1.2,!=2.1.6", "python-dateutil>=2.1",