@@ -2878,26 +2878,23 @@ def handle_single_axis(
28782878 shared = shared_axes .get_siblings (self )
28792879 # Base autoscaling on finite data limits when there is at least one
28802880 # finite data limit among all the shared_axes and intervals.
2881- # Also, find the minimum minpos for use in the margin calculation.
2882- x_values = []
2883- minimum_minpos = np .inf
2884- for ax in shared :
2885- x_values .extend (getattr (ax .dataLim , f"interval{ name } " ))
2886- minimum_minpos = min (minimum_minpos ,
2887- getattr (ax .dataLim , f"minpos{ name } " ))
2888- x_values = np .extract (np .isfinite (x_values ), x_values )
2889- if x_values .size >= 1 :
2890- x0 , x1 = (x_values .min (), x_values .max ())
2881+ values = [val for ax in shared
2882+ for val in getattr (ax .dataLim , f"interval{ name } " )
2883+ if np .isfinite (val )]
2884+ if values :
2885+ x0 , x1 = (min (values ), max (values ))
28912886 elif getattr (self ._viewLim , f"mutated{ name } " )():
28922887 # No data, but explicit viewLims already set:
28932888 # in mutatedx or mutatedy.
28942889 return
28952890 else :
28962891 x0 , x1 = (- np .inf , np .inf )
2897- # If x0 and x1 are non finite, use the locator to figure out
2898- # default limits.
2892+ # If x0 and x1 are nonfinite, get default limits from the locator.
28992893 locator = axis .get_major_locator ()
29002894 x0 , x1 = locator .nonsingular (x0 , x1 )
2895+ # Find the minimum minpos for use in the margin calculation.
2896+ minimum_minpos = min (
2897+ getattr (ax .dataLim , f"minpos{ name } " ) for ax in shared )
29012898
29022899 # Prevent margin addition from crossing a sticky value. A small
29032900 # tolerance must be added due to floating point issues with
@@ -4027,15 +4024,10 @@ def format_ydata(self, y):
40274024
40284025 def format_coord (self , x , y ):
40294026 """Return a format string formatting the *x*, *y* coordinates."""
4030- if x is None :
4031- xs = '???'
4032- else :
4033- xs = self .format_xdata (x )
4034- if y is None :
4035- ys = '???'
4036- else :
4037- ys = self .format_ydata (y )
4038- return 'x=%s y=%s' % (xs , ys )
4027+ return "x={} y={}" .format (
4028+ "???" if x is None else self .format_xdata (x ),
4029+ "???" if y is None else self .format_ydata (y ),
4030+ )
40394031
40404032 def minorticks_on (self ):
40414033 """
0 commit comments