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 ffb36ba

Browse filesBrowse files
committed
DOC: Add illustration to Figure.subplots_adjust
Closes #23005.
1 parent 4b35874 commit ffb36ba
Copy full SHA for ffb36ba

File tree

Expand file treeCollapse file tree

2 files changed

+30
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+30
-0
lines changed
Open diff view settings
Collapse file
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import matplotlib.pyplot as plt
2+
3+
def arrow(p1, p2, **props):
4+
axs[0, 0].annotate(
5+
"", p1, p2, xycoords='figure fraction',
6+
arrowprops=dict(arrowstyle="<->", shrinkA=0, shrinkB=0, **props))
7+
8+
fig, axs = plt.subplots(2, 2, figsize=(6.5, 4))
9+
fig.set_facecolor('lightblue')
10+
fig.subplots_adjust(0.1, 0.1, 0.9, 0.9, 0.4, 0.4)
11+
for ax in axs.flat:
12+
ax.set(xticks=[], yticks=[])
13+
14+
arrow((0, 0.75), (0.1, 0.75)) # left
15+
arrow((0.435, 0.75), (0.565, 0.75)) # wspace
16+
arrow((0.9, 0.75), (1, 0.75)) # right
17+
fig.text(0.05, 0.7, "left", ha="center")
18+
fig.text(0.5, 0.7, "wspace", ha="center")
19+
fig.text(0.95, 0.7, "right", ha="center")
20+
21+
arrow((0.25, 0), (0.25, 0.1)) # bottom
22+
arrow((0.25, 0.435), (0.25, 0.565)) # hspace
23+
arrow((0.25, 0.9), (0.25, 1)) # top
24+
fig.text(0.28, 0.05, "bottom", va="center")
25+
fig.text(0.28, 0.5, "hspace", va="center")
26+
fig.text(0.28, 0.95, "top", va="center")
Collapse file

‎lib/matplotlib/figure.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,10 @@ def subplots_adjust(self, left=None, bottom=None, right=None, top=None,
13221322
Unset parameters are left unmodified; initial values are given by
13231323
:rc:`figure.subplot.[name]`.
13241324
1325+
The following plot illustrates the effect of the parameters:
1326+
1327+
.. plot:: _embedded_plots/figure_subplots_adjust.py
1328+
13251329
Parameters
13261330
----------
13271331
left : float, optional

0 commit comments

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