From cd8d4f9692a28de67591b016db8fc0f5b869c59b Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 21 Oct 2019 17:36:51 +0200 Subject: [PATCH] Fix incorrect value check in axes_grid. --- lib/mpl_toolkits/axes_grid1/axes_grid.py | 2 +- lib/mpl_toolkits/tests/test_axes_grid1.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/mpl_toolkits/axes_grid1/axes_grid.py b/lib/mpl_toolkits/axes_grid1/axes_grid.py index 3a517b82c306..c5a15f56d0ef 100644 --- a/lib/mpl_toolkits/axes_grid1/axes_grid.py +++ b/lib/mpl_toolkits/axes_grid1/axes_grid.py @@ -499,7 +499,7 @@ def __init__(self, fig, if ngrids is None: ngrids = self._nrows * self._ncols else: - if not 0 <= ngrids < self._nrows * self._ncols: + if not 0 < ngrids <= self._nrows * self._ncols: raise Exception self.ngrids = ngrids diff --git a/lib/mpl_toolkits/tests/test_axes_grid1.py b/lib/mpl_toolkits/tests/test_axes_grid1.py index f01eef6e6f7d..9ed9a92804bb 100644 --- a/lib/mpl_toolkits/tests/test_axes_grid1.py +++ b/lib/mpl_toolkits/tests/test_axes_grid1.py @@ -102,6 +102,7 @@ def test_axesgrid_colorbar_log_smoketest(legacy_colorbar): fig = plt.figure() grid = AxesGrid(fig, 111, # modified to be only subplot nrows_ncols=(1, 1), + ngrids=1, label_mode="L", cbar_location="top", cbar_mode="single",