@@ -2875,17 +2875,16 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
2875
2875
if right is not None :
2876
2876
right = self .convert_xunits (right )
2877
2877
2878
- if ((left is not None and not np .isfinite (left )) or
2879
- (right is not None and not np .isfinite (right ))):
2880
- raise ValueError ("xlim limits must be finite. "
2881
- "instead, found: (%s, %s)" % (left , right ))
2882
-
2883
2878
old_left , old_right = self .get_xlim ()
2884
2879
if left is None :
2885
2880
left = old_left
2886
2881
if right is None :
2887
2882
right = old_right
2888
2883
2884
+ if not (np .isfinite (left ) and np .isfinite (right )):
2885
+ warnings .warn ('xlim limits must be finite.\n '
2886
+ 'instead, found: (%s, %s)' % (left , right ))
2887
+
2889
2888
if left == right :
2890
2889
warnings .warn (
2891
2890
('Attempting to set identical left==right results\n '
@@ -3159,18 +3158,17 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
3159
3158
if top is not None :
3160
3159
top = self .convert_yunits (top )
3161
3160
3162
- if ((top is not None and not np .isfinite (top )) or
3163
- (bottom is not None and not np .isfinite (bottom ))):
3164
- raise ValueError ("ylim limits must be finite. "
3165
- "instead, found: (%s, %s)" % (top , bottom ))
3166
-
3167
3161
old_bottom , old_top = self .get_ylim ()
3168
3162
3169
3163
if bottom is None :
3170
3164
bottom = old_bottom
3171
3165
if top is None :
3172
3166
top = old_top
3173
3167
3168
+ if not (np .isfinite (top ) and np .isfinite (bottom )):
3169
+ warnings .warn ('ylim limits must be finite.\n '
3170
+ 'instead, found: (%s, %s)' % (top , bottom ))
3171
+
3174
3172
if bottom == top :
3175
3173
warnings .warn (
3176
3174
('Attempting to set identical bottom==top results\n '
0 commit comments