Skip to content

Commit c6ce3f6

Browse files
committed
Replace numeric loc by position string
1 parent dd5f241 commit c6ce3f6

31 files changed

+81
-79
lines changed

doc/users/prev_whats_new/whats_new_2.1.0.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,11 @@ rectangle for the size bar.
261261

262262
fig, ax = plt.subplots(figsize=(3, 3))
263263

264-
bar0 = AnchoredSizeBar(ax.transData, 0.3, 'unfilled', loc=3, frameon=False,
265-
size_vertical=0.05, fill_bar=False)
264+
bar0 = AnchoredSizeBar(ax.transData, 0.3, 'unfilled', loc='lower left',
265+
frameon=False, size_vertical=0.05, fill_bar=False)
266266
ax.add_artist(bar0)
267-
bar1 = AnchoredSizeBar(ax.transData, 0.3, 'filled', loc=4, frameon=False,
268-
size_vertical=0.05, fill_bar=True)
267+
bar1 = AnchoredSizeBar(ax.transData, 0.3, 'filled', loc='lower right',
268+
frameon=False, size_vertical=0.05, fill_bar=True)
269269
ax.add_artist(bar1)
270270

271271
plt.show()

examples/axes_grid1/demo_anchored_direction_arrows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
high_contrast_part_1 = AnchoredDirectionArrows(
2121
ax.transAxes,
2222
'111', r'11$\overline{2}$',
23-
loc=1,
23+
loc='upper right',
2424
arrow_props={'ec': 'w', 'fc': 'none', 'alpha': 1,
2525
'lw': 2}
2626
)
@@ -29,7 +29,7 @@
2929
high_contrast_part_2 = AnchoredDirectionArrows(
3030
ax.transAxes,
3131
'111', r'11$\overline{2}$',
32-
loc=1,
32+
loc='upper right',
3333
arrow_props={'ec': 'none', 'fc': 'k'},
3434
text_props={'ec': 'w', 'fc': 'k', 'lw': 0.4}
3535
)

examples/axes_grid1/demo_axes_grid2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def add_inner_title(ax, title, loc, size=None, **kwargs):
6060
ax.cax.colorbar(im)
6161

6262
for ax, im_title in zip(grid, ["Image 1", "Image 2", "Image 3"]):
63-
t = add_inner_title(ax, im_title, loc=3)
63+
t = add_inner_title(ax, im_title, loc='lower left')
6464
t.patch.set_alpha(0.5)
6565

6666
for ax, z in zip(grid, ZS):
@@ -109,7 +109,7 @@ def add_inner_title(ax, title, loc, size=None, **kwargs):
109109
ax.cax.toggle_label(True)
110110

111111
for ax, im_title in zip(grid2, ["(a)", "(b)", "(c)"]):
112-
t = add_inner_title(ax, im_title, loc=2)
112+
t = add_inner_title(ax, im_title, loc='upper left')
113113
t.patch.set_ec("none")
114114
t.patch.set_alpha(0.5)
115115

examples/axes_grid1/demo_colorbar_of_inset_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_demo_image():
2828
ylim=(-20, 5))
2929

3030

31-
axins = zoomed_inset_axes(ax, 2, loc=2) # zoom = 6
31+
axins = zoomed_inset_axes(ax, zoom=2, loc='upper left')
3232
im = axins.imshow(Z, extent=extent, interpolation="nearest",
3333
origin="lower")
3434

@@ -40,7 +40,7 @@ def get_demo_image():
4040
cax = inset_axes(axins,
4141
width="5%", # width = 10% of parent_bbox width
4242
height="100%", # height : 50%
43-
loc=3,
43+
loc='lower left',
4444
bbox_to_anchor=(1.05, 0., 1, 1),
4545
bbox_transform=axins.transAxes,
4646
borderpad=0,

examples/axes_grid1/demo_colorbar_with_inset_locator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
axins1 = inset_axes(ax1,
1414
width="50%", # width = 10% of parent_bbox width
1515
height="5%", # height : 50%
16-
loc=1)
16+
loc='upper right')
1717

1818
im1 = ax1.imshow([[1, 2], [2, 3]])
1919
plt.colorbar(im1, cax=axins1, orientation="horizontal", ticks=[1, 2, 3])
@@ -22,7 +22,7 @@
2222
axins = inset_axes(ax2,
2323
width="5%", # width = 10% of parent_bbox width
2424
height="50%", # height : 50%
25-
loc=3,
25+
loc='lower left',
2626
bbox_to_anchor=(1.05, 0., 1, 1),
2727
bbox_transform=ax2.transAxes,
2828
borderpad=0,

examples/axes_grid1/inset_locator_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def add_sizebar(ax, size):
1414
asb = AnchoredSizeBar(ax.transData,
1515
size,
1616
str(size),
17-
loc=8,
17+
loc='lower center',
1818
pad=0.1, borderpad=0.5, sep=5,
1919
frameon=False)
2020
ax.add_artist(asb)
@@ -28,7 +28,7 @@ def add_sizebar(ax, size):
2828
axins = inset_axes(ax,
2929
width="30%", # width = 30% of parent_bbox
3030
height=1., # height : 1 inch
31-
loc=3)
31+
loc='lower left')
3232

3333
plt.xticks(visible=False)
3434
plt.yticks(visible=False)

examples/axes_grid1/inset_locator_demo2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def get_demo_image():
3232
ax.imshow(Z2, extent=extent, interpolation="nearest",
3333
origin="lower")
3434

35-
axins = zoomed_inset_axes(ax, 6, loc=1) # zoom = 6
35+
axins = zoomed_inset_axes(ax, zoom=6, loc='upper right')
3636
axins.imshow(Z2, extent=extent, interpolation="nearest",
3737
origin="lower")
3838

examples/axes_grid1/simple_anchored_artists.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,14 @@ def draw_text(ax):
1818
corner of the figure.
1919
"""
2020
from matplotlib.offsetbox import AnchoredText
21-
# loc=2 is equivalent to loc='upper left'
2221
at = AnchoredText("Figure 1a",
23-
loc=2, prop=dict(size=8), frameon=True,
22+
loc='upper left', prop=dict(size=8), frameon=True,
2423
)
2524
at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
2625
ax.add_artist(at)
2726

28-
# loc=3 is eqivalent to loc='lower left'
2927
at2 = AnchoredText("Figure 1(b)",
30-
loc=3, prop=dict(size=8), frameon=True,
28+
loc='lower left', prop=dict(size=8), frameon=True,
3129
bbox_to_anchor=(0., 1.),
3230
bbox_transform=ax.transAxes
3331
)
@@ -42,7 +40,7 @@ def draw_circle(ax):
4240
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea
4341
from matplotlib.patches import Circle
4442
ada = AnchoredDrawingArea(20, 20, 0, 0,
45-
loc=1, pad=0., frameon=False)
43+
loc='upper right', pad=0., frameon=False)
4644
p = Circle((10, 10), 10)
4745
ada.da.add_artist(p)
4846
ax.add_artist(ada)
@@ -54,7 +52,8 @@ def draw_ellipse(ax):
5452
"""
5553
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredEllipse
5654
ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0.,
57-
loc=3, pad=0.5, borderpad=0.4, frameon=True)
55+
loc='lower left', pad=0.5, borderpad=0.4,
56+
frameon=True)
5857

5958
ax.add_artist(ae)
6059

@@ -68,7 +67,7 @@ def draw_sizebar(ax):
6867
asb = AnchoredSizeBar(ax.transData,
6968
0.1,
7069
r"1$^{\prime}$",
71-
loc=8,
70+
loc='lower center',
7271
pad=0.1, borderpad=0.5, sep=5,
7372
frameon=False)
7473
ax.add_artist(asb)

examples/lines_bars_and_markers/markevery_prop_cycle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
for i in range(len(cases)):
5757
ax.plot(yy[:, i], marker='o', label=str(cases[i]))
58-
ax.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
58+
ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.)
5959

6060
plt.title('Support for axes.prop_cycle cycler with markevery')
6161

examples/lines_bars_and_markers/scatter_symbol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
label="Luck")
2323
plt.xlabel("Leprechauns")
2424
plt.ylabel("Gold")
25-
plt.legend(loc=2)
25+
plt.legend(loc='upper left')
2626
plt.show()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy