@@ -80,7 +80,8 @@ def _plot_args_replacer(args, data):
80
80
81
81
def _make_inset_locator (rect , trans , parent ):
82
82
"""
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`.
84
85
85
86
A locator gets used in `Axes.set_aspect` to override the default
86
87
locations... It is a function that takes an axes object and
@@ -411,7 +412,7 @@ def legend(self, *args, **kwargs):
411
412
def _remove_legend (self , legend ):
412
413
self .legend_ = None
413
414
414
- def inset_axes_from_lbwh (self , lbwh , * , transform = None , zorder = 5 ,
415
+ def inset_axes_from_bounds (self , bounds , * , transform = None , zorder = 5 ,
415
416
** kwargs ):
416
417
"""
417
418
Add a child inset axes to this existing axes.
@@ -424,7 +425,7 @@ def inset_axes_from_lbwh(self, lbwh, *, transform=None, zorder=5,
424
425
Parameters
425
426
----------
426
427
427
- lbwh : [x0, y0, width, height]
428
+ bounds : [x0, y0, width, height]
428
429
Lower-left corner of inset axes, and its width and height.
429
430
430
431
transform : `.Transform`
@@ -454,17 +455,17 @@ def inset_axes_from_lbwh(self, lbwh, *, transform=None, zorder=5,
454
455
455
456
fig, ax = plt.suplots()
456
457
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 (
459
460
[5, 7, 2.3, 2.3], transform=ax.transData)
460
461
461
462
"""
462
463
if transform is None :
463
464
transform = self .transAxes
464
- label = kwargs .pop ('label' , 'inset_axes_from_lbwh ' )
465
+ label = kwargs .pop ('label' , 'inset_axes_from_bounds ' )
465
466
466
467
# 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 )
468
469
bb = inset_locator (None , None )
469
470
470
471
inset_ax = Axes (self .figure , bb .bounds , zorder = zorder ,
@@ -478,13 +479,14 @@ def inset_axes_from_lbwh(self, lbwh, *, transform=None, zorder=5,
478
479
479
480
return inset_ax
480
481
481
- def indicate_inset_lbwh (self , lbwh , inset_ax = None , * , transform = None ,
482
+ def indicate_inset_bounds (self , bounds , inset_ax = None , * , transform = None ,
482
483
facecolor = 'none' , edgecolor = '0.5' , alpha = 0.5 ,
483
484
zorder = 4.99 , ** kwargs ):
484
485
"""
485
486
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`).
488
490
489
491
Warnings
490
492
--------
@@ -495,7 +497,7 @@ def indicate_inset_lbwh(self, lbwh, inset_ax=None, *, transform=None,
495
497
Parameters
496
498
----------
497
499
498
- lbwh : [x0, y0, width, height]
500
+ bounds : [x0, y0, width, height]
499
501
Lower-left corner of rectangle to be marked, and its width
500
502
and height.
501
503
@@ -545,10 +547,10 @@ def indicate_inset_lbwh(self, lbwh, inset_ax=None, *, transform=None,
545
547
546
548
if transform is None :
547
549
transform = self .transData
548
- label = kwargs .pop ('label' , 'indicate_inset_lbwh ' )
550
+ label = kwargs .pop ('label' , 'indicate_inset_bounds ' )
549
551
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 ],
552
554
facecolor = facecolor , edgecolor = edgecolor , alpha = alpha ,
553
555
zorder = zorder , label = label , transform = transform , ** kwargs )
554
556
self .add_patch (rectpatch )
@@ -559,8 +561,8 @@ def indicate_inset_lbwh(self, lbwh, inset_ax=None, *, transform=None,
559
561
pos = inset_ax .get_position () # this is in fig-fraction.
560
562
coordsA = 'axes fraction'
561
563
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 ]]
564
566
for xc in range (2 ):
565
567
for yc in range (2 ):
566
568
xyA = (xc , yc )
@@ -574,7 +576,7 @@ def indicate_inset_lbwh(self, lbwh, inset_ax=None, *, transform=None,
574
576
pos = inset_ax .get_position ()
575
577
bboxins = pos .transformed (self .figure .transFigure )
576
578
rectbbox = mtransforms .Bbox .from_bounds (
577
- * lbwh ).transformed (transform )
579
+ * bounds ).transformed (transform )
578
580
if rectbbox .x0 < bboxins .x0 :
579
581
sig = 1
580
582
else :
@@ -626,7 +628,7 @@ def indicate_inset_zoom(self, inset_ax, **kwargs):
626
628
xlim = inset_ax .get_xlim ()
627
629
ylim = inset_ax .get_ylim ()
628
630
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 (
630
632
rect , inset_ax , ** kwargs )
631
633
632
634
return rectpatch , connects
0 commit comments