Set the Axes box aspect. The box aspect is the ratio of height to width in display units for each face of the box when viewed perpendicular to that face. This is not to be confused with the data aspect (see `~.Axes3D.set_aspect`). The default ratios are 4:4
(self, aspect, *, zoom=1)
| 395 | return ax_indices |
| 396 | |
| 397 | def set_box_aspect(self, aspect, *, zoom=1): |
| 398 | """ |
| 399 | Set the Axes box aspect. |
| 400 | |
| 401 | The box aspect is the ratio of height to width in display |
| 402 | units for each face of the box when viewed perpendicular to |
| 403 | that face. This is not to be confused with the data aspect (see |
| 404 | `~.Axes3D.set_aspect`). The default ratios are 4:4:3 (x:y:z). |
| 405 | |
| 406 | To simulate having equal aspect in data space, set the box |
| 407 | aspect to match your data range in each dimension. |
| 408 | |
| 409 | *zoom* controls the overall size of the Axes3D in the figure. |
| 410 | |
| 411 | Parameters |
| 412 | ---------- |
| 413 | aspect : 3-tuple of floats or None |
| 414 | Changes the physical dimensions of the Axes3D, such that the ratio |
| 415 | of the axis lengths in display units is x:y:z. |
| 416 | If None, defaults to (4, 4, 3). |
| 417 | |
| 418 | zoom : float, default: 1 |
| 419 | Control overall size of the Axes3D in the figure. Must be > 0. |
| 420 | """ |
| 421 | if zoom <= 0: |
| 422 | raise ValueError(f'Argument zoom = {zoom} must be > 0') |
| 423 | |
| 424 | if aspect is None: |
| 425 | aspect = np.asarray((4, 4, 3), dtype=float) |
| 426 | else: |
| 427 | aspect = np.asarray(aspect, dtype=float) |
| 428 | _api.check_shape((3,), aspect=aspect) |
| 429 | # The scale 1.8294640721620434 is tuned to match the mpl3.2 appearance. |
| 430 | # The 25/24 factor is to compensate for the change in automargin |
| 431 | # behavior in mpl3.9. This comes from the padding of 1/48 on both sides |
| 432 | # of the axes in mpl3.8. |
| 433 | aspect *= 1.8294640721620434 * 25/24 * zoom / np.linalg.norm(aspect) |
| 434 | |
| 435 | self._box_aspect = self._roll_to_vertical(aspect, reverse=True) |
| 436 | self.stale = True |
| 437 | |
| 438 | def apply_aspect(self, position=None): |
| 439 | if position is None: |