From 4ace2a41a1b5f3ca48dd24c7b8ca593239f82f5f Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Sat, 10 Jun 2017 15:53:42 -0700 Subject: [PATCH 1/3] Colorbar now accepts ndarray of axes, not just list --- lib/matplotlib/colorbar.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index a080eb59247c..9fdcca333522 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -1117,9 +1117,10 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, parent_anchor = kw.pop('panchor', loc_settings['panchor']) pad = kw.pop('pad', loc_settings['pad']) - # turn parents into a list if it is not already - if not isinstance(parents, (list, tuple)): - parents = [parents] + # turn parents into a list if it is not already. We do this w/ np + # because `ax=plt.subplots(1,1)` is an ndarray and is natural to + # pass to `colorbar`. + parents = np.atleast_1d(parents).ravel().tolist() fig = parents[0].get_figure() if not all(fig is ax.get_figure() for ax in parents): From 585c670adefeb3c142707a4ba7dc0d0bc64c4464 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Sat, 10 Jun 2017 17:27:55 -0700 Subject: [PATCH 2/3] Colorbar now accepts ndarray of axes, not just list --- lib/matplotlib/colorbar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 9fdcca333522..f268f22341cf 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -1120,7 +1120,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, # turn parents into a list if it is not already. We do this w/ np # because `ax=plt.subplots(1,1)` is an ndarray and is natural to # pass to `colorbar`. - parents = np.atleast_1d(parents).ravel().tolist() + parents = np.atleast_1d(parents).ravel() fig = parents[0].get_figure() if not all(fig is ax.get_figure() for ax in parents): From 81271ff3ffd5b58153a0e454105f0ebfb840cf12 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Sat, 10 Jun 2017 20:37:25 -0700 Subject: [PATCH 3/3] Colorbar now accepts ndarray of axes, not just list --- lib/matplotlib/colorbar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index f268f22341cf..5894ecf123c2 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -1118,7 +1118,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, pad = kw.pop('pad', loc_settings['pad']) # turn parents into a list if it is not already. We do this w/ np - # because `ax=plt.subplots(1,1)` is an ndarray and is natural to + # because `plt.subplots` can return an ndarray and is natural to # pass to `colorbar`. parents = np.atleast_1d(parents).ravel()