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 435db99

Browse filesBrowse files
committed
FIX: renamed methods again
1 parent 8a7a7f7 commit 435db99
Copy full SHA for 435db99

File tree

Expand file treeCollapse file tree

4 files changed

+26
-24
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+26
-24
lines changed

‎doc/api/axes_api.rst

Copy file name to clipboardExpand all lines: doc/api/axes_api.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ Text and Annotations
165165
Axes.text
166166
Axes.table
167167
Axes.arrow
168-
Axes.inset_axes_from_lbwh
169-
Axes.indicate_inset_lbwh
168+
Axes.inset_axes_from_bounds
169+
Axes.indicate_inset_bounds
170170
Axes.indicate_inset_zoom
171171

172172

‎examples/subplots_axes_and_figures/zoom_inset_axes.py

Copy file name to clipboardExpand all lines: examples/subplots_axes_and_figures/zoom_inset_axes.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def get_demo_image():
3131
origin="lower")
3232

3333
# inset axes....
34-
axins = ax.inset_axes_from_lbwh([0.5, 0.5, 0.47, 0.47])
34+
axins = ax.inset_axes_from_bounds([0.5, 0.5, 0.47, 0.47])
3535
axins.imshow(Z2, extent=extent, interpolation="nearest",
3636
origin="lower")
3737
# sub region of the original image
@@ -55,6 +55,6 @@ def get_demo_image():
5555
# The use of the following functions and methods is shown in this example:
5656

5757
import matplotlib
58-
matplotlib.axes.Axes.inset_axes_from_lbwh
58+
matplotlib.axes.Axes.inset_axes_from_bounds
5959
matplotlib.axes.Axes.indicate_inset_zoom
6060
matplotlib.axes.Axes.imshow

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+20-18Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def _plot_args_replacer(args, data):
8080

8181
def _make_inset_locator(rect, trans, parent):
8282
"""
83-
Helper function to locate inset axes, used in `.Axes.inset_axes_from_lbwh`.
83+
Helper function to locate inset axes, used in
84+
`.Axes.inset_axes_from_bounds`.
8485
8586
A locator gets used in `Axes.set_aspect` to override the default
8687
locations... It is a function that takes an axes object and
@@ -411,7 +412,7 @@ def legend(self, *args, **kwargs):
411412
def _remove_legend(self, legend):
412413
self.legend_ = None
413414

414-
def inset_axes_from_lbwh(self, lbwh, *, transform=None, zorder=5,
415+
def inset_axes_from_bounds(self, bounds, *, transform=None, zorder=5,
415416
**kwargs):
416417
"""
417418
Add a child inset axes to this existing axes.
@@ -424,7 +425,7 @@ def inset_axes_from_lbwh(self, lbwh, *, transform=None, zorder=5,
424425
Parameters
425426
----------
426427
427-
lbwh : [x0, y0, width, height]
428+
bounds : [x0, y0, width, height]
428429
Lower-left corner of inset axes, and its width and height.
429430
430431
transform : `.Transform`
@@ -454,17 +455,17 @@ def inset_axes_from_lbwh(self, lbwh, *, transform=None, zorder=5,
454455
455456
fig, ax = plt.suplots()
456457
ax.plot(range(10))
457-
axin1 = ax.inset_axes_from_lbwh([0.8, 0.1, 0.15, 0.15])
458-
axin2 = ax.inset_axes_from_lbwh(
458+
axin1 = ax.inset_axes_from_bounds([0.8, 0.1, 0.15, 0.15])
459+
axin2 = ax.inset_axes_from_bounds(
459460
[5, 7, 2.3, 2.3], transform=ax.transData)
460461
461462
"""
462463
if transform is None:
463464
transform = self.transAxes
464-
label = kwargs.pop('label', 'inset_axes_from_lbwh')
465+
label = kwargs.pop('label', 'inset_axes_from_bounds')
465466

466467
# This puts the rectangle into figure-relative coordinates.
467-
inset_locator = _make_inset_locator(lbwh, transform, self)
468+
inset_locator = _make_inset_locator(bounds, transform, self)
468469
bb = inset_locator(None, None)
469470

470471
inset_ax = Axes(self.figure, bb.bounds, zorder=zorder,
@@ -478,13 +479,14 @@ def inset_axes_from_lbwh(self, lbwh, *, transform=None, zorder=5,
478479

479480
return inset_ax
480481

481-
def indicate_inset_lbwh(self, lbwh, inset_ax=None, *, transform=None,
482+
def indicate_inset_bounds(self, bounds, inset_ax=None, *, transform=None,
482483
facecolor='none', edgecolor='0.5', alpha=0.5,
483484
zorder=4.99, **kwargs):
484485
"""
485486
Add an inset indicator to the axes. This is a rectangle on the plot
486-
at the position indicated by *lbwh* that optionally has lines that
487-
connect the rectangle to an inset axes (`.Axes.inset_axes_from_lbwh`).
487+
at the position indicated by *bounds* that optionally has lines that
488+
connect the rectangle to an inset axes
489+
(`.Axes.inset_axes_from_bounds`).
488490
489491
Warnings
490492
--------
@@ -495,7 +497,7 @@ def indicate_inset_lbwh(self, lbwh, inset_ax=None, *, transform=None,
495497
Parameters
496498
----------
497499
498-
lbwh : [x0, y0, width, height]
500+
bounds : [x0, y0, width, height]
499501
Lower-left corner of rectangle to be marked, and its width
500502
and height.
501503
@@ -545,10 +547,10 @@ def indicate_inset_lbwh(self, lbwh, inset_ax=None, *, transform=None,
545547

546548
if transform is None:
547549
transform = self.transData
548-
label = kwargs.pop('label', 'indicate_inset_lbwh')
550+
label = kwargs.pop('label', 'indicate_inset_bounds')
549551

550-
xy = (lbwh[0], lbwh[1])
551-
rectpatch = mpatches.Rectangle(xy, lbwh[2], lbwh[3],
552+
xy = (bounds[0], bounds[1])
553+
rectpatch = mpatches.Rectangle(xy, bounds[2], bounds[3],
552554
facecolor=facecolor, edgecolor=edgecolor, alpha=alpha,
553555
zorder=zorder, label=label, transform=transform, **kwargs)
554556
self.add_patch(rectpatch)
@@ -559,8 +561,8 @@ def indicate_inset_lbwh(self, lbwh, inset_ax=None, *, transform=None,
559561
pos = inset_ax.get_position() # this is in fig-fraction.
560562
coordsA = 'axes fraction'
561563
connects = []
562-
xr = [lbwh[0], lbwh[0]+lbwh[2]]
563-
yr = [lbwh[1], lbwh[1]+lbwh[3]]
564+
xr = [bounds[0], bounds[0]+bounds[2]]
565+
yr = [bounds[1], bounds[1]+bounds[3]]
564566
for xc in range(2):
565567
for yc in range(2):
566568
xyA = (xc, yc)
@@ -574,7 +576,7 @@ def indicate_inset_lbwh(self, lbwh, inset_ax=None, *, transform=None,
574576
pos = inset_ax.get_position()
575577
bboxins = pos.transformed(self.figure.transFigure)
576578
rectbbox = mtransforms.Bbox.from_bounds(
577-
*lbwh).transformed(transform)
579+
*bounds).transformed(transform)
578580
if rectbbox.x0 < bboxins.x0:
579581
sig = 1
580582
else:
@@ -626,7 +628,7 @@ def indicate_inset_zoom(self, inset_ax, **kwargs):
626628
xlim = inset_ax.get_xlim()
627629
ylim = inset_ax.get_ylim()
628630
rect = [xlim[0], ylim[0], xlim[1] - xlim[0], ylim[1] - ylim[0]]
629-
rectpatch, connects = self.indicate_inset_lbwh(
631+
rectpatch, connects = self.indicate_inset_bounds(
630632
rect, inset_ax, **kwargs)
631633

632634
return rectpatch, connects

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5743,8 +5743,8 @@ def test_zoom_inset():
57435743
ax.apply_aspect()
57445744
# we need to apply_aspect to make the drawing below work.
57455745

5746-
# Make the inset_axes_from_lbwh... Position axes co-ordinates...
5747-
axin1 = ax.inset_axes_from_lbwh([0.7, 0.7, 0.35, 0.35])
5746+
# Make the inset_axes_from_bounds... Position axes co-ordinates...
5747+
axin1 = ax.inset_axes_from_bounds([0.7, 0.7, 0.35, 0.35])
57485748
# redraw the data in the inset axes...
57495749
axin1.pcolormesh(x, y, z)
57505750
axin1.set_xlim([1.5, 2.15])

0 commit comments

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