@@ -1216,18 +1216,17 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
12161216
12171217 Parameters
12181218 ----------
1219- aspect : {'auto', 'equal' } or num
1219+ aspect : {'auto'} or num
12201220 Possible values:
12211221
1222- ======== ================================================
1222+ ======== =================================================
12231223 value description
1224- ======== ================================================
1225- 'auto' automatic; fill the position rectangle with data
1226- 'equal' same scaling from data to plot units for x and y
1227- num a circle will be stretched such that the height
1228- is num times the width. aspect=1 is the same as
1229- aspect='equal'.
1230- ======== ================================================
1224+ ======== =================================================
1225+ 'auto' automatic; fill the position rectangle with data.
1226+ num a circle will be stretched such that the height
1227+ is *num* times the width. 'equal' is a synonym
1228+ for ``aspect=1``, i.e. same scaling for x and y.
1229+ ======== =================================================
12311230
12321231 adjustable : None or {'box', 'datalim'}, optional
12331232 If not ``None``, this defines which parameter will be adjusted to
@@ -1262,15 +1261,15 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
12621261 matplotlib.axes.Axes.set_anchor
12631262 defining the position in case of extra space.
12641263 """
1265- if not (cbook ._str_equal (aspect , 'equal' )
1266- or cbook ._str_equal (aspect , 'auto' )):
1264+ if cbook ._str_equal (aspect , 'equal' ):
1265+ aspect = 1
1266+ if not cbook ._str_equal (aspect , 'auto' ):
1267+ if self .name == '3d' :
1268+ raise NotImplementedError (
1269+ 'It is not currently possible to manually set the aspect '
1270+ 'on 3D axes' )
12671271 aspect = float (aspect ) # raise ValueError if necessary
12681272
1269- if (not cbook ._str_equal (aspect , 'auto' )) and self .name == '3d' :
1270- raise NotImplementedError (
1271- 'It is not currently possible to manually set the aspect '
1272- 'on 3D axes' )
1273-
12741273 if share :
12751274 axes = {* self ._shared_x_axes .get_siblings (self ),
12761275 * self ._shared_y_axes .get_siblings (self )}
@@ -1532,9 +1531,6 @@ def apply_aspect(self, position=None):
15321531 self ._set_position (position , which = 'active' )
15331532 return
15341533
1535- if aspect == 'equal' :
1536- aspect = 1
1537-
15381534 fig_width , fig_height = self .get_figure ().get_size_inches ()
15391535 fig_aspect = fig_height / fig_width
15401536
0 commit comments