Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf6ffe6

Browse files
authored
Merge pull request#27202 from meeseeksmachine/auto-backport-of-pr-27178-on-v3.8.x
Backport PR#27178 on branch v3.8.x (Try/except import of Axes3D)
2 parents0486d36 +152f261 commitcf6ffe6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

‎lib/matplotlib/projections/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@
5555
from ..importaxes,_docstring
5656
from .geoimportAitoffAxes,HammerAxes,LambertAxes,MollweideAxes
5757
from .polarimportPolarAxes
58-
frommpl_toolkits.mplot3dimportAxes3D
58+
59+
try:
60+
frommpl_toolkits.mplot3dimportAxes3D
61+
exceptImportError:
62+
importwarnings
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
5967

6068

6169
classProjectionRegistry:
@@ -87,8 +95,12 @@ def get_projection_names(self):
8795
HammerAxes,
8896
LambertAxes,
8997
MollweideAxes,
90-
Axes3D,
9198
)
99+
ifAxes3DisnotNone:
100+
projection_registry.register(Axes3D)
101+
else:
102+
# remove from namespace if not importable
103+
delAxes3D
92104

93105

94106
defregister_projection(cls):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp