8000 DOC: fix gs tutorial and remove subplot2grid section · matplotlib/matplotlib@f3b2efd · GitHub
[go: up one dir, main page]

Skip to content

Commit f3b2efd

Browse files
committed
DOC: fix gs tutorial and remove subplot2grid section
1 parent 14a80bb commit f3b2efd

File tree

1 file changed

+2
-40
lines changed
Original file line numberDiff line numberDiff line change
@@ -124,44 +124,6 @@
124124
fig5.tight_layout()
125125

126126

127-
###############################################################################
128-
# Using subplot2grid
129-
# ==================
130-
#
131-
# To use :func:`~matplotlib.pyplot.subplot2grid`, you provide geometry of
132-
# the grid and the location of the subplot in the grid.
133-
# For a simple single-cell subplot:
134-
135-
fig = plt.figure()
136-
ax = plt.subplot2grid((2, 2), (0, 0), fig=fig)
137-
138-
139-
###############################################################################
140-
# The example above is the same as the more common approach shown below.
141-
142-
fig = plt.figure()
143-
ax = fig.add_subplot(2, 2, 1)
144-
145-
###############################################################################
146-
# Note that, unlike Matplotlib's subplot, the index starts from 0 in GridSpec.
147-
#
148-
# To create a subplot that spans multiple cells:
149-
150-
fig = plt.figure()
151-
ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2, fig=fig)
152-
ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2, fig=fig)
153-
154-
###############################################################################
155-
# For example, see the output of the following commands:
156-
157-
fig = plt.figure()
158-
ax1 = plt.subplot2grid((3, 3), (0, 0), colspan=3, fig=fig)
159-
ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2, fig=fig)
160-
ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2, fig=fig)
161-
ax4 = plt.subplot2grid((3, 3), (2, 0), fig=fig)
162-
ax5 = plt.subplot2grid((3, 3), (2, 1), fig=fig)
163-
fig.tight_layout()
164-
165127
###############################################################################
166128
# Fine Adjustments to a Gridspec Layout
167129
# =====================================
@@ -180,14 +142,14 @@
180142

181143
fig = plt.figure()
182144
gs1 = gridspec.GridSpec(nrows=3, ncols=3, left=0.05, right=0.48,
183-
wspace=0.05, fig=fig)
145+
wspace=0.05)
184146
ax1 = fig.add_subplot(gs1[:-1, :])
185147
ax2 = fig.add_subplot(gs1[-1, :-1])
186148
ax3 = fig.add_subplot(gs1[-1, -1])
187149

188150

189151
gs2 = gridspec.GridSpec(nrows=3, ncols=3, left=0.55, right=0.98,
190-
hspace=0.05, fig=fig)
152+
hspace=0.05)
191153
ax4 = fig.add_subplot(gs2[:, :-1])
192154
ax5 = fig.add_subplot(gs2[:-1, -1])
193155
ax6 = fig.add_subplot(gs2[-1, -1])