8000 In examples, prefer named locations rather than location numbers. · matplotlib/matplotlib@b845b6d · GitHub
[go: up one dir, main page]

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 b845b6d

Browse files
committed
In examples, prefer named locations rather than location numbers.
1 parent cb9cf3b commit b845b6d

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

galleries/examples/axes_grid1/inset_locator_demo.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@
2020
fig, (ax, ax2) = plt.subplots(1, 2, figsize=[5.5, 2.8])
2121

2222
# Create inset of width 1.3 inches and height 0.9 inches
23-
# at the default upper right location
23+
# at the default upper right location.
2424
axins = inset_axes(ax, width=1.3, height=0.9)
2525

2626
# Create inset of width 30% and height 40% of the parent Axes' bounding box
27-
# at the lower left corner (loc=3)
28-
axins2 = inset_axes(ax, width="30%", height="40%", loc=3)
27+
# at the lower left corner.
28+
axins2 = inset_axes(ax, width="30%", height="40%", loc="lower left")
2929

3030
# Create inset of mixed specifications in the second subplot;
3131
# width is 30% of parent Axes' bounding box and
32-
# height is 1 inch at the upper left corner (loc=2)
33-
axins3 = inset_axes(ax2, width="30%", height=1., loc=2)
32+
# height is 1 inch at the upper left corner.
33+
axins3 = inset_axes(ax2, width="30%", height=1., loc="upper left")
3434

35-
# Create an inset in the lower right corner (loc=4) with borderpad=1, i.e.
36-
# 10 points padding (as 10pt is the default fontsize) to the parent Axes
37-
axins4 = inset_axes(ax2, width="20%", height="20%", loc=4, borderpad=1)
35+
# Create an inset in the lower right corner with borderpad=1, i.e.
36+
# 10 points padding (as 10pt is the default fontsize) to the parent Axes.
37+
axins4 = inset_axes(ax2, width="20%", height="20%", loc="lower right", borderpad=1)
3838

3939
# Turn ticklabels of insets off
4040
for axi in [axins, axins2, axins3, axins4]:
@@ -61,12 +61,12 @@
6161
# in those coordinates.
6262
# Inside this bounding box an inset of half the bounding box' width and
6363
# three quarters of the bounding box' height is created. The lower left corner
64-
# of the inset is aligned to the lower left corner of the bounding box (loc=3).
64+
# of the inset is aligned to the lower left corner of the bounding box.
6565
# The inset is then offset by the default 0.5 in units of the font size.
6666

6767
axins = inset_axes(ax, width="50%", height="75%",
6868
bbox_to_anchor=(.2, .4, .6, .5),
69-
bbox_transform=ax.transAxes, loc=3)
69+
bbox_transform=ax.transAxes, loc="lower left")
7070

7171
# For visualization purposes we mark the bounding box by a rectangle
7272
ax.add_patch(plt.Rectangle((.2, .4), .6, .5, ls="--", ec="c", fc="none",
@@ -113,15 +113,15 @@
113113
# Create an inset outside the Axes
114114
axins = inset_axes(ax, width="100%", height="100%",
115115
bbox_to_anchor=(1.05, .6, .5, .4),
116-
bbox_transform=ax.transAxes, loc=2, borderpad=0)
116+
bbox_transform=ax.transAxes, loc="upper left", borderpad=0)
117117
axins.tick_params(left=False, right=True, labelleft=False, labelright=True)
118118

119119
# Create an inset with a 2-tuple bounding box. Note that this creates a
120120
# bbox without extent. This hence only makes sense when specifying
121121
# width and height in absolute units (inches).
122122
axins2 = inset_axes(ax, width=0.5, height=0.4,
123123
bbox_to_anchor=(0.33, 0.25),
124-
bbox_transform=ax.transAxes, loc=3, borderpad=0)
124+
bbox_transform=ax.transAxes, loc="lower left", borderpad=0)
125125

126126

127127
ax2 = fig.add_subplot(133)
@@ -131,7 +131,7 @@
131131
# Create inset in data coordinates using ax.transData as transform
132132
axins3 = inset_axes(ax2, width="100%", height="100%",
133133
bbox_to_anchor=(1e-2, 2, 1e3, 3),
134-
bbox_transform=ax2.transData, loc=2, borderpad=0)
134+
bbox_transform=ax2.transData, loc="upper left", borderpad=0)
135135

136136
# Create an inset horizontally centered in figure coordinates and vertically
137137
# bound to line up with the Axes.
@@ -140,6 +140,6 @@
140140
transform = blended_transform_factory(fig.transFigure, ax2.transAxes)
141141
axins4 = inset_axes(ax2, width="16%", height="34%",
142142
bbox_to_anchor=(0, 0, 1, 1),
143-
bbox_transform=transform, loc=8, borderpad=0)
143+
bbox_transform=transform, loc="lower center", borderpad=0)
144144

145145
plt.show()

galleries/examples/axes_grid1/inset_locator_demo2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def add_sizebar(ax, size):
3636
asb = AnchoredSizeBar(ax.transData,
3737
size,
3838
str(size),
39-
loc=8,
39+
loc="lower center",
4040
pad=0.1, borderpad=0.5, sep=5,
4141
frameon=False)
4242
ax.add_artist(asb)
@@ -54,7 +54,7 @@ def add_sizebar(ax, size):
5454

5555
ax2.imshow(Z2, extent=extent, origin="lower")
5656

57-
axins2 = zoomed_inset_axes(ax2, zoom=6, loc=1)
57+
axins2 = zoomed_inset_axes(ax2, zoom=6, loc="upper right")
5858
axins2.imshow(Z2, extent=extent, origin="lower")
5959

6060
# subregion of the original image

0 commit comments

Comments
 (0)
0