From 3211425a9925ea2c356bf3792121100cd0eba882 Mon Sep 17 00:00:00 2001 From: kkdd Date: Fri, 8 Apr 2016 00:25:03 +0900 Subject: [PATCH 1/2] Update _base.py --- lib/matplotlib/axes/_base.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index c11bb9c3af33..9ffbb9ce3309 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) From dde6318a10e84b8487acbe89dac2c9ccb84d5a51 Mon Sep 17 00:00:00 2001 From: kkdd Date: Fri, 8 Apr 2016 00:27:51 +0900 Subject: [PATCH 2/2] Update _base.py --- lib/matplotlib/axes/_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 9ffbb9ce3309..c4304f42ec54 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1249,7 +1249,7 @@ def set_aspect(self, aspect, adjustable=None, anchor=None): '1.2', name='normal', alternative='auto', obj_type='aspect') self._aspect = 'auto' else: - raise ValueError("error in aspect") + raise ValueError("error in aspect") if adjustable is not None: self.set_adjustable(adjustable)