An Axis class for the 3D plots.
| 36 | |
| 37 | |
| 38 | class Axis(maxis.XAxis): |
| 39 | """An Axis class for the 3D plots.""" |
| 40 | # These points from the unit cube make up the x, y and z-planes |
| 41 | _PLANES = ( |
| 42 | (0, 3, 7, 4), (1, 2, 6, 5), # yz planes |
| 43 | (0, 1, 5, 4), (3, 2, 6, 7), # xz planes |
| 44 | (0, 1, 2, 3), (4, 5, 6, 7), # xy planes |
| 45 | ) |
| 46 | |
| 47 | # Some properties for the axes |
| 48 | _AXINFO = { |
| 49 | 'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2)}, |
| 50 | 'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2)}, |
| 51 | 'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1)}, |
| 52 | } |
| 53 | |
| 54 | def _old_init(self, adir, v_intervalx, d_intervalx, axes, *args, |
| 55 | rotate_label=None, **kwargs): |
| 56 | return locals() |
| 57 | |
| 58 | def _new_init(self, axes, *, rotate_label=None, **kwargs): |
| 59 | return locals() |
| 60 | |
| 61 | def __init__(self, *args, **kwargs): |
| 62 | params = _api.select_matching_signature( |
| 63 | [self._old_init, self._new_init], *args, **kwargs) |
| 64 | if "adir" in params: |
| 65 | _api.warn_deprecated( |
| 66 | "3.6", message=f"The signature of 3D Axis constructors has " |
| 67 | f"changed in %(since)s; the new signature is " |
| 68 | f"{inspect.signature(type(self).__init__)}", pending=True) |
| 69 | if params["adir"] != self.axis_name: |
| 70 | raise ValueError(f"Cannot instantiate {type(self).__name__} " |
| 71 | f"with adir={params['adir']!r}") |
| 72 | axes = params["axes"] |
| 73 | rotate_label = params["rotate_label"] |
| 74 | args = params.get("args", ()) |
| 75 | kwargs = params["kwargs"] |
| 76 | |
| 77 | name = self.axis_name |
| 78 | |
| 79 | self._label_position = 'default' |
| 80 | self._tick_position = 'default' |
| 81 | |
| 82 | # This is a temporary member variable. |
| 83 | # Do not depend on this existing in future releases! |
| 84 | self._axinfo = self._AXINFO[name].copy() |
| 85 | # Common parts |
| 86 | self._axinfo.update({ |
| 87 | 'label': {'va': 'center', 'ha': 'center', |
| 88 | 'rotation_mode': 'anchor'}, |
| 89 | 'color': mpl.rcParams[f'axes3d.{name}axis.panecolor'], |
| 90 | 'tick': { |
| 91 | 'inward_factor': 0.2, |
| 92 | 'outward_factor': 0.1, |
| 93 | }, |
| 94 | }) |
| 95 |
nothing calls this directly
no test coverage detected
searching dependent graphs…