8000 Merge pull request #12334 from QuLogic/inset-indicators · matplotlib/matplotlib@97cad3d · GitHub
[go: up one dir, main page]

Skip to content

Commit 97cad3d

Browse files
Merge pull request #12334 from QuLogic/inset-indicators
Improve selection of inset indicator connectors.
2 parents 85c9742 + ac2afc6 commit 97cad3d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -580,16 +580,14 @@ def indicate_inset(self, bounds, inset_ax=None, *, transform=None,
580580
bboxins = pos.transformed(self.figure.transFigure)
581581
rectbbox = mtransforms.Bbox.from_bounds(
582582
*bounds).transformed(transform)
583-
if rectbbox.x0 < bboxins.x0:
584-
sig = 1
585-
else:
586-
sig = -1
587-
if sig*rectbbox.y0 < sig*bboxins.y0:
588-
connects[0].set_visible(False)
589-
connects[3].set_visible(False)
590-
else:
591-
connects[1].set_visible(False)
592-
connects[2].set_visible(False)
583+
x0 = rectbbox.x0 < bboxins.x0
584+
x1 = rectbbox.x1 < bboxins.x1
585+
y0 = rectbbox.y0 < bboxins.y0
586+
y1 = rectbbox.y1 < bboxins.y1
587+
connects[0].set_visible(x0 ^ y0)
588+
connects[1].set_visible(x0 == y1)
589+
connects[2].set_visible(x1 == y0)
590+
connects[3].set_visible(x1 ^ y1)
593591

594592
return rectpatch, connects
595593

0 commit comments

Comments
 (0)
0