Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c754f55

Browse filesBrowse files
authored
Merge pull request #9605 from matplotlib/auto-backport-of-pr-9604
Backport PR #9604 on branch v2.1.x
2 parents e9fcb97 + 3308501 commit c754f55
Copy full SHA for c754f55

File tree

Expand file treeCollapse file tree

2 files changed

+35
-11
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+35
-11
lines changed

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+32-8Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,18 +1186,42 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
11861186

11871187
def subplot2grid(shape, loc, rowspan=1, colspan=1, fig=None, **kwargs):
11881188
"""
1189-
Create a subplot in a grid. The grid is specified by *shape*, at
1190-
location of *loc*, spanning *rowspan*, *colspan* cells in each
1191-
direction. The index for loc is 0-based. The current figure will
1192-
be used unless *fig* is specified. ::
1189+
Create an axis at specific location inside a regular grid.
11931190
1194-
subplot2grid(shape, loc, rowspan=1, colspan=1)
1191+
Parameters
1192+
----------
1193+
shape : sequence of 2 ints
1194+
Shape of grid in which to place axis.
1195+
First entry is number of rows, second entry is number of columns.
1196+
1197+
loc : sequence of 2 ints
1198+
Location to place axis within grid.
1199+
First entry is row number, second entry is column number.
1200+
1201+
rowspan : int
1202+
Number of rows for the axis to span to the right.
1203+
1204+
colspan : int
1205+
Number of columns for the axis to span downwards.
1206+
1207+
fig : `Figure`, optional
1208+
Figure to place axis in. Defaults to current figure.
1209+
1210+
**kwargs
1211+
Additional keyword arguments are handed to `add_subplot`.
1212+
1213+
1214+
Notes
1215+
-----
1216+
The following call ::
1217+
1218+
subplot2grid(shape, loc, rowspan=1, colspan=1)
11951219
11961220
is identical to ::
11971221
1198-
gridspec=GridSpec(shape[0], shape[1])
1199-
subplotspec=gridspec.new_subplotspec(loc, rowspan, colspan)
1200-
subplot(subplotspec)
1222+
gridspec=GridSpec(shape[0], shape[1])
1223+
subplotspec=gridspec.new_subplotspec(loc, rowspan, colspan)
1224+
subplot(subplotspec)
12011225
"""
12021226

12031227
if fig is None:

‎tutorials/intermediate/gridspec.py

Copy file name to clipboardExpand all lines: tutorials/intermediate/gridspec.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@
7575

7676
# A GridSpec instance provides array-like (2d or 1d) indexing that
7777
# returns the SubplotSpec instance. For a SubplotSpec that spans multiple
78-
# cells, use slice. ::
78+
# cells, use slice.
7979

8080
ax2 = plt.subplot(gs[1, :-1])
8181
ax3 = plt.subplot(gs[1:, -1])
8282

8383
###############################################################################
84-
# The above example becomes ::
84+
# The above example becomes
8585

8686
fig = plt.figure()
8787
gs = gridspec.GridSpec(3, 3)
@@ -96,7 +96,7 @@
9696
# ======================
9797
#
9898
# When a GridSpec is explicitly used, you can adjust the layout
99-
# parameters of subplots that are created from the GridSpec. ::
99+
# parameters of subplots that are created from the GridSpec.
100100

101101
fig = plt.figure()
102102
gs1 = gridspec.GridSpec(3, 3)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.