8000 DOC: clarify docs on Axes3D.set_aspect and Axes3D.set_box_aspect · matplotlib/matplotlib@4c0b944 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c0b944

Browse files
committed
DOC: clarify docs on Axes3D.set_aspect and Axes3D.set_box_aspect
1 parent 7cde8de commit 4c0b944

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,14 @@ def tunit_edges(self, vals=None, M=None):
268268

269269
def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
270270
"""
271-
Set the aspect of the axis scaling.
271+
Set the aspect ratios.
272+
273+
Axes 3D does not current support any aspect but 'auto' which fills
274+
the axes with the data limits.
275+
276+
To simulate having equal aspect in data space, set the ratio
277+
of your data limits to match the value of `~.get_box_aspect`.
278+
To control box aspect ratios use `~.Axes3D.set_box_aspect`.
272279
273280
Parameters
274281
----------
@@ -281,13 +288,13 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
281288
'auto' automatic; fill the position rectangle with data.
282289
========= ==================================================
283290
284-
adjustable : None or {'box', 'datalim'}, optional
291+
adjustable : None
292+
Currently ignored by Axes3D
293+
285294
If not *None*, this defines which parameter will be adjusted to
286295
meet the required aspect. See `.set_adjustable` for further
287296
details.
288297
289-
Currently ignored by Axes3D
290-
291298
anchor : None or str or 2-tuple of float, optional
292299
If not *None*, this defines where the Axes will be drawn if there
293300
is extra space due to aspect constraints. The most common way to
@@ -314,7 +321,7 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
314321
"""
315322
if aspect != 'auto':
316323
raise NotImplementedError(
317-
"Axes3D currently only support the aspect arguments "
324+
"Axes3D currently only supports the aspect argument "
318325
f"'auto'. You passed in {aspect!r}."
319326
)
320327

@@ -353,28 +360,27 @@ def set_box_aspect(self, aspect, *, zoom=1):
353360
"""
354361
Set the axes box aspect.
355362
356-
The box aspect is the ratio of the axes height to the axes width in
357-
physical units. This is not to be confused with the data
358-
aspect, set via `~.Axes.set_aspect`.
363+
The box aspect is the ratio of height to width in display
364+
units for each face of the box when viewed perpendicular to
365+
that face. This is not to be confused with the data aspect
366+
(which for Axes3D is always 'auto'). The default ratios are
367+
4:4:3 (x:y:z).
368+
369+
To simulate having equal aspect in data space, set the box
370+
aspect to match your data range in each dimension.
359371
360-
The *zoom* is an Axes3D-only parameter that controls the overall
361-
size of the Axes3D in the figure.
372+
*zoom* controls the overall size of the Axes3D in the figure.
362373
363374
Parameters
364375
----------
365376
aspect : 3-tuple of floats or None
366377
Changes the physical dimensions of the Axes3D, such that the ratio
367-
of the axis lengths in physical units is x:y:z.
378+
of the axis lengths in display units is x:y:z.
368379
369380
If None, defaults to 4:4:3
370381
371382
zoom : float
372383
Control overall size of the Axes3D in the figure.
373-
374-
See Also
375-
--------
376-
mpl_toolkits.mplot3d.axes3d.Axes3D.set_aspect
377-
for a description of aspect handling.
378384
"""
379385
if aspect is None:
380386
aspect = np.asarray((4, 4, 3), dtype=float)

0 commit comments

Comments
 (0)
0