From 551d35c17b3140c5043575976c3bba51e53def6a Mon Sep 17 00:00:00 2001 From: Skipper Seabold Date: Thu, 2 Jun 2011 17:39:47 -0400 Subject: [PATCH 1/2] Patched pyplot.subplots for squeeze==False --- lib/matplotlib/pyplot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index e68ed2515239..ee3abf56191a 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -799,6 +799,9 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, ret = fig, axarr[0,0] else: ret = fig, axarr.squeeze() + else: + # returned axis array will be always 2-d, even if nrows=ncols=1 + return fig, axarr.reshape(nrows, ncols) return ret From 23ac081a20ad9e81c2212dcb2b15d87c389994d8 Mon Sep 17 00:00:00 2001 From: Skipper Seabold Date: Wed, 15 Jun 2011 16:06:37 -0400 Subject: [PATCH 2/2] Make return in pyplot.subplot clearer --- lib/matplotlib/pyplot.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index ee3abf56191a..7716eff37a9a 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -801,8 +801,7 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, ret = fig, axarr.squeeze() else: # returned axis array will be always 2-d, even if nrows=ncols=1 - return fig, axarr.reshape(nrows, ncols) - + ret = fig, axarr.reshape(nrows, ncols) return ret