File tree 1 file changed +14
-2
lines changed
lib/matplotlib/projections
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 55
55
from .. import axes , _docstring
56
56
from .geo import AitoffAxes , HammerAxes , LambertAxes , MollweideAxes
57
57
from .polar import PolarAxes
58
- from mpl_toolkits .mplot3d import Axes3D
58
+
59
+ try :
60
+ from mpl_toolkits .mplot3d import Axes3D
61
+ except ImportError :
62
+ import warnings
63
+ warnings .warn ("Unable to import Axes3D. This may be due to multiple versions of "
64
+ "Matplotlib being installed (e.g. as a system package and as a pip "
65
+ "package). As a result, the 3D projection is not available." )
66
+ Axes3D = None
59
67
60
68
61
69
class ProjectionRegistry :
@@ -87,8 +95,12 @@ def get_projection_names(self):
87
95
HammerAxes ,
88
96
LambertAxes ,
89
97
MollweideAxes ,
90
- Axes3D ,
91
98
)
99
+ if Axes3D is not None :
100
+ projection_registry .register (Axes3D )
101
+ else :
102
+ # remove from namespace if not importable
103
+ del Axes3D
92
104
93
105
94
106
def register_projection (cls ):
You can’t perform that action at this time.
0 commit comments