@@ -2822,6 +2822,7 @@ def _set_lim(self, axis, low, high, low_name, high_name,
2822
2822
"""Helper factoring the functionality of `get_{x,y,z}lim`."""
2823
2823
# Perhaps we can use axis.{get,set}_view_interval()... but zaxis seems
2824
2824
# to behave differently.
2825
+ _called_from_pan = kw .pop ("_called_from_pan" , False )
2825
2826
if kw :
2826
2827
raise ValueError ("Unrecognized kwargs: {}" .format (kw ))
2827
2828
axis_name = axis .axis_name
@@ -2835,7 +2836,8 @@ def _set_lim(self, axis, low, high, low_name, high_name,
2835
2836
self ._process_unit_info (** {"{}data" .format (axis_name ): [low , high ]})
2836
2837
low , high = map (axis .convert_units , [low , high ])
2837
2838
for limit in [low , high ]:
2838
- if not np .isreal (limit ) or not np .isfinite (limit ):
2839
+ if not (_called_from_pan or
2840
+ np .isreal (limit ) and np .isfinite (limit )):
2839
2841
raise ValueError (
2840
2842
"Axis limits must be (or convert to) finite reals" )
2841
2843
if low == high :
@@ -3774,8 +3776,8 @@ def format_deltas(key, dx, dy):
3774
3776
warnings .warn ('Overflow while panning' )
3775
3777
return
3776
3778
3777
- self .set_xlim (* result .intervalx )
3778
- self .set_ylim (* result .intervaly )
3779
+ self .set_xlim (* result .intervalx , _called_from_pan = True )
3780
+ self .set_ylim (* result .intervaly , _called_from_pan = True )
3779
3781
3780
3782
@cbook .deprecated ("2.1" )
3781
3783
def get_cursor_props (self ):
0 commit comments