@@ -346,22 +346,25 @@ def set_box_aspect(self, aspect, *, zoom=1):
346
346
347
347
Parameters
348
348
----------
349
- aspect : 3-tuple of floats or None
349
+ aspect : 3-tuple of floats or None, default: None
350
350
Changes the physical dimensions of the Axes3D, such that the ratio
351
351
of the axis lengths in display units is x:y:z.
352
+ If None, defaults to (4,4,3)
352
353
353
- If None, defaults to 4:4:3
354
-
355
- zoom : float
354
+ zoom : float, default: 1
356
355
Control overall size of the Axes3D in the figure.
357
356
"""
357
+ if zoom <= 0 :
358
+ raise ValueError (f'Argument zoom = { zoom } must be > 0' )
359
+ self .zoom = zoom
360
+
358
361
if aspect is None :
359
362
aspect = np .asarray ((4 , 4 , 3 ), dtype = float )
360
363
else :
361
364
aspect = np .asarray (aspect , dtype = float )
362
365
_api .check_shape ((3 ,), aspect = aspect )
363
366
# default scale tuned to match the mpl32 appearance.
364
- aspect *= 1.8294640721620434 * zoom / np .linalg .norm (aspect )
367
+ aspect *= 1.8294640721620434 * self . zoom / np .linalg .norm (aspect )
365
368
366
369
self ._box_aspect = aspect
367
370
self .stale = True
@@ -1006,7 +1009,7 @@ def view_init(self, elev=None, azim=None, roll=None, vertical_axis="z"):
1006
1009
The axis to align vertically. *azim* rotates about this axis.
1007
1010
"""
1008
1011
1009
- self .dist = 10
1012
+ self .dist = 10 # The camera distance from origin. Behaves like zoom
1010
1013
1011
1014
if elev is None :
1012
1015
self .elev = self .initial_elev
0 commit comments