diff --git a/.circleci/config.yml b/.circleci/config.yml index d94052f62087..d7c959ae0bde 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -134,7 +134,7 @@ jobs: - run: <<: *deps-install environment: - NUMPY_VERSION: "==1.10.0" + NUMPY_VERSION: "==1.11.0" - run: *mpl-install - run: *doc-build diff --git a/INSTALL.rst b/INSTALL.rst index 5e4ca0645374..358363bdde79 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -136,7 +136,7 @@ Matplotlib requires the following dependencies: * `Python `_ (>= 3.5) * `FreeType `_ (>= 2.3) * `libpng `_ (>= 1.2) -* `NumPy `_ (>= 1.10.0) +* `NumPy `_ (>= 1.11) * `setuptools `_ * `cycler `_ (>= 0.10.0) * `dateutil `_ (>= 2.1) diff --git a/doc/api/next_api_changes/2018-11-22-AL.rst b/doc/api/next_api_changes/2018-11-22-AL.rst new file mode 100644 index 000000000000..3d7977e43389 --- /dev/null +++ b/doc/api/next_api_changes/2018-11-22-AL.rst @@ -0,0 +1,3 @@ +Numpy minimum version bump +`````````````````````````` +Matplotlib 3.1 requires numpy>=1.11. diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 7735b0cdd604..b67e36dd7700 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -191,7 +191,7 @@ def _check_versions(): ("cycler", "0.10"), ("dateutil", "2.1"), ("kiwisolver", "1.0.1"), - ("numpy", "1.10"), + ("numpy", "1.11"), ("pyparsing", "2.0.1"), ]: module = importlib.import_module(modname) diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 243e9a42318a..339114fbb281 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -254,10 +254,8 @@ def _dt64_to_ordinalf(d): # the "extra" ensures that we at least allow the dynamic range out to # seconds. That should get out to +/-2e11 years. - # NOTE: First cast truncates; second cast back is for NumPy 1.10. - extra = d - d.astype('datetime64[s]').astype(d.dtype) - extra = extra.astype('timedelta64[ns]') - t0 = np.datetime64('0001-01-01T00:00:00').astype('datetime64[s]') + extra = (d - d.astype('datetime64[s]')).astype('timedelta64[ns]') + t0 = np.datetime64('0001-01-01T00:00:00', 's') dt = (d.astype('datetime64[s]') - t0).astype(np.float64) dt += extra.astype(np.float64) / 1.0e9 dt = dt / SEC_PER_DAY + 1.0 diff --git a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.pdf b/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.pdf deleted file mode 100644 index e3cc69089946..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.pdf and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.png b/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.png deleted file mode 100644 index 176f27cb2d21..000000000000 Binary files a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.png and /dev/null differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.svg b/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.svg deleted file mode 100644 index fb33c61e02a4..000000000000 --- a/lib/matplotlib/tests/baseline_images/test_axes/formatter_large_small.svg +++ /dev/null @@ -1,603 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index f6e3f733b95b..271c515e20db 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -132,17 +132,6 @@ def test_formatter_ticker(): ax.autoscale_view() -@image_comparison(baseline_images=["formatter_large_small"]) -def test_formatter_large_small(): - # github issue #617, pull #619 - if LooseVersion(np.__version__) >= LooseVersion('1.11.0'): - pytest.skip("Fall out from a fixed numpy bug") - fig, ax = plt.subplots(1) - x = [0.500000001, 0.500000002] - y = [1e64, 1.1e64] - ax.plot(x, y) - - @image_comparison(baseline_images=["twin_axis_locaters_formatters"]) def test_twin_axis_locaters_formatters(): vals = np.linspace(0, 1, num=5, endpoint=True) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index fb39bfba9dc7..c4323660915c 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -187,15 +187,6 @@ 'SymmetricalLogLocator', 'LogitLocator') -# Work around numpy/numpy#6127. -def _divmod(x, y): - if isinstance(x, np.generic): - x = x.item() - if isinstance(y, np.generic): - y = y.item() - return divmod(x, y) - - def _mathdefault(s): return '\\mathdefault{%s}' % s @@ -1665,7 +1656,7 @@ def view_limits(self, vmin, vmax): vmax += 1 if rcParams['axes.autolimit_mode'] == 'round_numbers': - exponent, remainder = _divmod( + exponent, remainder = divmod( math.log10(vmax - vmin), math.log10(max(self.numticks - 1, 1))) exponent -= (remainder < .5) scale = max(self.numticks - 1, 1) ** (-exponent) @@ -1690,14 +1681,14 @@ def __init__(self, base): def lt(self, x): 'return the largest multiple of base < x' - d, m = _divmod(x, self._base) + d, m = divmod(x, self._base) if closeto(m, 0) and not closeto(m / self._base, 1): return (d - 1) * self._base return d * self._base def le(self, x): 'return the largest multiple of base <= x' - d, m = _divmod(x, self._base) + d, m = divmod(x, self._base) if closeto(m / self._base, 1): # was closeto(m, self._base) #looks like floating point error return (d + 1) * self._base @@ -1705,7 +1696,7 @@ def le(self, x): def gt(self, x): 'return the smallest multiple of base > x' - d, m = _divmod(x, self._base) + d, m = divmod(x, self._base) if closeto(m / self._base, 1): #looks like floating point error return (d + 2) * self._base @@ -1713,7 +1704,7 @@ def gt(self, x): def ge(self, x): 'return the smallest multiple of base >= x' - d, m = _divmod(x, self._base) + d, m = divmod(x, self._base) if closeto(m, 0) and not closeto(m / self._base, 1): return d * self._base return (d + 1) * self._base @@ -1808,14 +1799,14 @@ def closeto(self, ms, edge): def le(self, x): 'Return the largest n: n*step <= x.' - d, m = _divmod(x, self.step) + d, m = divmod(x, self.step) if self.closeto(m / self.step, 1): return (d + 1) return d def ge(self, x): 'Return the smallest n: n*step >= x.' - d, m = _divmod(x, self.step) + d, m = divmod(x, self.step) if self.closeto(m / self.step, 0): return d return (d + 1) diff --git a/requirements/testing/travis35.txt b/requirements/testing/travis35.txt index 10f3a43447c1..9f32b5d9c754 100644 --- a/requirements/testing/travis35.txt +++ b/requirements/testing/travis35.txt @@ -2,7 +2,7 @@ cycler==0.10 python-dateutil==2.1 -numpy==1.10.0 +numpy==1.11 pandas<0.21.0 pyparsing==2.0.1 pytest==3.6 diff --git a/setupext.py b/setupext.py index 0d558302678b..d5f4b81f5621 100644 --- a/setupext.py +++ b/setupext.py @@ -774,24 +774,22 @@ def include_dirs_hook(): return [numpy.get_include()] def add_flags(self, ext): - # Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for - # each extension - array_api_name = 'MPL_' + ext.name.replace('.', '_') + '_ARRAY_API' - - ext.define_macros.append(('PY_ARRAY_UNIQUE_SYMBOL', array_api_name)) ext.add_hook('include_dirs', self.include_dirs_hook) - - ext.define_macros.append(('NPY_NO_DEPRECATED_API', - 'NPY_1_7_API_VERSION')) - - # Allow NumPy's printf format specifiers in C++. - ext.define_macros.append(('__STDC_FORMAT_MACROS', 1)) + ext.define_macros.extend([ + # Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for each + # extension. + ('PY_ARRAY_UNIQUE_SYMBOL', + 'MPL_' + ext.name.replace('.', '_') + '_ARRAY_API'), + ('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION'), + # Allow NumPy's printf format specifiers in C++. + ('__STDC_FORMAT_MACROS', 1), + ]) def get_setup_requires(self): - return ['numpy>=1.10.0'] + return ['numpy>=1.11'] def get_install_requires(self): - return ['numpy>=1.10.0'] + return ['numpy>=1.11'] class LibAgg(SetupPackage):