-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy paththree.py
More file actions
43 lines (33 loc) · 1.28 KB
/
three.py
File metadata and controls
43 lines (33 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
"""
The "3D" axes class.
"""
from . import base, shared
try:
from mpl_toolkits.mplot3d import Axes3D
except ImportError:
Axes3D = object
class ThreeAxes(shared._SharedAxes, base.Axes, Axes3D):
"""
Simple mix-in of `ultraplot.axes.Axes` with `~mpl_toolkits.mplot3d.axes3d.Axes3D`.
Important
---------
Note that this subclass does *not* implement the :class:`~ultraplot.axes.PlotAxes`
plotting overrides. This axes subclass can be used by passing ``proj='3d'`` or
``proj='three'`` to axes-creation commands like `~ultraplot.figure.Figure.add_axes`,
`~ultraplot.figure.Figure.add_subplot`, and `~ultraplot.figure.Figure.subplots`.
"""
# TODO: Figure out a way to have internal Axes3D calls to plotting commands
# access the overrides rather than the originals? May be impossible.
_name = "three"
_name_aliases = ("3d",)
def __init__(self, *args, **kwargs):
import mpl_toolkits.mplot3d # noqa: F401 verify package is available
kwargs.setdefault("alpha", 0.0)
super().__init__(*args, **kwargs)
def graph(self, *args, **kwargs):
"""
Draw network graphs on 3D projections.
"""
from .plot import PlotAxes
return PlotAxes.graph(self, *args, **kwargs)