@@ -1216,18 +1216,17 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
1216
1216
1217
1217
Parameters
1218
1218
----------
1219
- aspect : {'auto', 'equal' } or num
1219
+ aspect : {'auto'} or num
1220
1220
Possible values:
1221
1221
1222
- ======== ================================================
1222
+ ======== =================================================
1223
1223
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
+ ======== =================================================
1231
1230
1232
1231
adjustable : None or {'box', 'datalim'}, optional
1233
1232
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):
1262
1261
matplotlib.axes.Axes.set_anchor
1263
1262
defining the position in case of extra space.
1264
1263
"""
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' )
1267
1271
aspect = float (aspect ) # raise ValueError if necessary
1268
1272
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
-
1274
1273
if share :
1275
1274
axes = {* self ._shared_x_axes .get_siblings (self ),
1276
1275
* self ._shared_y_axes .get_siblings (self )}
@@ -1532,9 +1531,6 @@ def apply_aspect(self, position=None):
1532
1531
self ._set_position (position , which = 'active' )
1533
1532
return
1534
1533
1535
- if aspect == 'equal' :
1536
- aspect = 1
1537
-
1538
1534
fig_width , fig_height = self .get_figure ().get_size_inches ()
1539
1535
fig_aspect = fig_height / fig_width
1540
1536
0 commit comments