@@ -2541,27 +2541,15 @@ def handle_single_axis(scale, autoscaleon, shared_axes, interval,
2541
2541
shared = shared_axes .get_siblings (self )
2542
2542
dl = [ax .dataLim for ax in shared ]
2543
2543
# ignore non-finite data limits if good limits exist
2544
- finite_dl = [d for d in dl if np .isfinite (d ).all ()]
2545
- if len (finite_dl ):
2546
- # if finite limits exist for at least one axis (and the
2547
- # other is infinite), restore the finite limits
2548
- x_finite = [d for d in dl
2549
- if (np .isfinite (d .intervalx ).all () and
2550
- (d not in finite_dl ))]
2551
- y_finite = [d for d in dl
2552
- if (np .isfinite (d .intervaly ).all () and
2553
- (d not in finite_dl ))]
2554
-
2555
- dl = finite_dl
2556
- dl .extend (x_finite )
2557
- dl .extend (y_finite )
2558
-
2559
- bb = mtransforms .BboxBase .union (dl )
2560
- # Issue 18137
2561
- # bb can still have infinite limits, so instead compute
2562
- # finite limits for this 'axis'
2563
- x_values = [getattr (d , interval ) for d in dl ]
2564
- x_values = np .sort (np .unique (np .asarray (x_values ).flatten ()))
2544
+ # issue 18137: The previous code would allow one subplot with
2545
+ # inifinite data limits to 'clobber' other subplots with finite
2546
+ # data limits.
2547
+ x_values = []
2548
+ minpos_values = []
2549
+ for d in dl :
2550
+ x_values .extend (getattr (d , interval ))
2551
+ minpos_values .append (getattr (d , minpos ))
2552
+ x_values = np .sort (x_values ).flatten ()
2565
2553
finite_x_values = np .extract (np .isfinite (x_values ), x_values )
2566
2554
if finite_x_values .size >= 1 :
2567
2555
x0 , x1 = (finite_x_values .min (), finite_x_values .max ())
@@ -2587,7 +2575,7 @@ def handle_single_axis(scale, autoscaleon, shared_axes, interval,
2587
2575
2588
2576
# Add the margin in figure space and then transform back, to handle
2589
2577
# non-linear scales.
2590
- minpos = getattr ( bb , minpos )
2578
+ minpos = np . min ( minpos_values )
2591
2579
transform = axis .get_transform ()
2592
2580
inverse_trans = transform .inverted ()
2593
2581
x0 , x1 = axis ._scale .limit_range_for_scale (x0 , x1 , minpos )
0 commit comments