diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index c11bb9c3af33..c4304f42ec54 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1239,15 +1239,17 @@ def set_aspect(self, aspect, adjustable=None, anchor=None): .. deprecated:: 1.2 the option 'normal' for aspect is deprecated. Use 'auto' instead. """ - if aspect == 'normal': - cbook.warn_deprecated( - '1.2', name='normal', alternative='auto', obj_type='aspect') - self._aspect = 'auto' - - elif aspect in ('equal', 'auto'): - self._aspect = aspect - else: + try: self._aspect = float(aspect) # raise ValueError if necessary + except ValueError: + if aspect in ('equal', 'auto'): + self._aspect = aspect + elif aspect == 'normal': + cbook.warn_deprecated( + '1.2', name='normal', alternative='auto', obj_type='aspect') + self._aspect = 'auto' + else: + raise ValueError("error in aspect") if adjustable is not None: self.set_adjustable(adjustable)
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: