From 819c48386daa6b6a240bd9e4f74f5413ad8fbd33 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 26 Feb 2019 16:19:42 -0800 Subject: [PATCH 1/3] DOC: fix Subplot calls --- .../gridspec_nested.py | 18 ++++++------------ tutorials/intermediate/gridspec.py | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/examples/subplots_axes_and_figures/gridspec_nested.py b/examples/subplots_axes_and_figures/gridspec_nested.py index e233e643ec68..28359e4f7720 100644 --- a/examples/subplots_axes_and_figures/gridspec_nested.py +++ b/examples/subplots_axes_and_figures/gridspec_nested.py @@ -24,22 +24,16 @@ def format_axes(fig): gs00 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gs0[0]) -ax1 = plt.Subplot(f, gs00[:-1, :]) -f.add_subplot(ax1) -ax2 = plt.Subplot(f, gs00[-1, :-1]) -f.add_subplot(ax2) -ax3 = plt.Subplot(f, gs00[-1, -1]) -f.add_subplot(ax3) +ax1 = f.add_subplot(gs00[:-1, :]) +ax2 = f.add_subplot(gs00[-1, :-1]) +ax3 = f.add_subplot(gs00[-1, -1]) gs01 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gs0[1]) -ax4 = plt.Subplot(f, gs01[:, :-1]) -f.add_subplot(ax4) -ax5 = plt.Subplot(f, gs01[:-1, -1]) -f.add_subplot(ax5) -ax6 = plt.Subplot(f, gs01[-1, -1]) -f.add_subplot(ax6) +ax4 = f.add_subplot(gs01[:, :-1]) +ax5 = f.add_subplot(gs01[:-1, -1]) +ax6 = f.add_subplot(gs01[-1, -1]) plt.suptitle("GridSpec Inside GridSpec") format_axes(f) diff --git a/tutorials/intermediate/gridspec.py b/tutorials/intermediate/gridspec.py index 48e19545f1c5..df46971cd164 100644 --- a/tutorials/intermediate/gridspec.py +++ b/tutorials/intermediate/gridspec.py @@ -242,7 +242,7 @@ def squiggle_xy(a, b, c, d, i=np.arange(0.0, 2*np.pi, 0.05)): inner_grid = outer_grid[i].subgridspec(3, 3, wspace=0.0, hspace=0.0) a, b = int(i/4)+1, i % 4+1 for j, (c, d) in enumerate(product(range(1, 4), repeat=2)): - ax = plt.Subplot(fig11, inner_grid[j]) + ax = fig11.add_subplot(inner_grid[j]) ax.plot(*squiggle_xy(a, b, c, d)) ax.set_xticks([]) ax.set_yticks([]) From e587e5e2c11d05597fb605285198f1d8fe0261f2 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 26 Feb 2019 18:03:25 -0800 Subject: [PATCH 2/3] DOC: fix Subplot calls --- examples/subplots_axes_and_figures/gridspec_nested.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/subplots_axes_and_figures/gridspec_nested.py b/examples/subplots_axes_and_figures/gridspec_nested.py index 28359e4f7720..13ddc550294e 100644 --- a/examples/subplots_axes_and_figures/gridspec_nested.py +++ b/examples/subplots_axes_and_figures/gridspec_nested.py @@ -28,8 +28,8 @@ def format_axes(fig): ax2 = f.add_subplot(gs00[-1, :-1]) ax3 = f.add_subplot(gs00[-1, -1]) - -gs01 = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=gs0[1]) +# the following syntax is the same as the GridSpecFromSubplotSpec call above: +gs01 = gs0[1].subgridspec(3, 3) ax4 = f.add_subplot(gs01[:, :-1]) ax5 = f.add_subplot(gs01[:-1, -1]) From ac04967a070ce5b9256af809212a469c91be9818 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 26 Feb 2019 18:03:46 -0800 Subject: [PATCH 3/3] DOC: fix Subplot calls --- examples/subplots_axes_and_figures/gridspec_nested.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/subplots_axes_and_figures/gridspec_nested.py b/examples/subplots_axes_and_figures/gridspec_nested.py index 13ddc550294e..75fa34f7b0b9 100644 --- a/examples/subplots_axes_and_figures/gridspec_nested.py +++ b/examples/subplots_axes_and_figures/gridspec_nested.py @@ -28,7 +28,7 @@ def format_axes(fig): ax2 = f.add_subplot(gs00[-1, :-1]) ax3 = f.add_subplot(gs00[-1, -1]) -# the following syntax is the same as the GridSpecFromSubplotSpec call above: +# the following syntax does the same as the GridSpecFromSubplotSpec call above: gs01 = gs0[1].subgridspec(3, 3) ax4 = f.add_subplot(gs01[:, :-1])