@@ -3805,7 +3805,7 @@ def format_deltas(key, dx, dy):
38053805 dy = dy / abs (dy ) * abs (dx )
38063806 else :
38073807 dx = dx / abs (dx ) * abs (dy )
3808- return ( dx , dy )
3808+ return dx , dy
38093809
38103810 p = self ._pan_start
38113811 dx = x - p .x
@@ -3814,29 +3814,30 @@ def format_deltas(key, dx, dy):
38143814 return
38153815 if button == 1 :
38163816 dx , dy = format_deltas (key , dx , dy )
3817- result = p .bbox .translated (- dx , - dy ) \
3818- .transformed (p .trans_inverse )
3817+ result = p .bbox .translated (- dx , - dy ).transformed (p .trans_inverse )
38193818 elif button == 3 :
38203819 try :
3821- dx = - dx / float ( self .bbox .width )
3822- dy = - dy / float ( self .bbox .height )
3820+ dx = - dx / self .bbox .width
3821+ dy = - dy / self .bbox .height
38233822 dx , dy = format_deltas (key , dx , dy )
38243823 if self .get_aspect () != 'auto' :
3825- dx = 0.5 * (dx + dy )
3826- dy = dx
3827-
3824+ dx = dy = 0.5 * (dx + dy )
38283825 alpha = np .power (10.0 , (dx , dy ))
38293826 start = np .array ([p .x , p .y ])
38303827 oldpoints = p .lim .transformed (p .trans )
38313828 newpoints = start + alpha * (oldpoints - start )
3832- result = mtransforms .Bbox (newpoints ) \
3833- .transformed (p .trans_inverse )
3829+ result = ( mtransforms .Bbox (newpoints )
3830+ .transformed (p .trans_inverse ) )
38343831 except OverflowError :
38353832 warnings .warn ('Overflow while panning' )
38363833 return
38373834
3838- self .set_xlim (* result .intervalx )
3839- self .set_ylim (* result .intervaly )
3835+ valid = np .isfinite (result .transformed (p .trans ))
3836+ points = result .get_points ().astype (object )
3837+ # Just ignore invalid limits (typically, underflow in log-scale).
3838+ points [~ valid ] = None
3839+ self .set_xlim (points [:, 0 ])
3840+ self .set_ylim (points [:, 1 ])
38403841
38413842 @cbook .deprecated ("2.1" )
38423843 def get_cursor_props (self ):
0 commit comments