Skip to content

Commit 33e4420

Browse files
committed
Prevent import errors if plotting will not be used
Fix poliastro#629. For a better error message when ipywidgets is missing, see plotly/plotly.py#1111
1 parent 2f3e2a4 commit 33e4420

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/poliastro/twobody/orbit.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
from poliastro.core.angles import nu_to_M as nu_to_M_fast
1919
from poliastro.core.elements import rv2coe
2020
from poliastro.frames import Planes, get_frame
21-
from poliastro.plotting.core import OrbitPlotter2D, OrbitPlotter3D
22-
from poliastro.plotting.static import StaticOrbitPlotter
2321
from poliastro.twobody.angles import E_to_nu, M_to_nu, nu_to_M
2422
from poliastro.twobody.propagation import mean_motion, propagate
2523
from poliastro.util import (
@@ -1168,8 +1166,14 @@ def plot(self, label=None, use_3d=False, interactive=False):
11681166
"The static plotter does not support 3D, use `interactive=True`"
11691167
)
11701168
elif not interactive:
1169+
from poliastro.plotting.static import StaticOrbitPlotter
1170+
11711171
return StaticOrbitPlotter().plot(self, label=label)
11721172
elif use_3d:
1173+
from poliastro.plotting.core import OrbitPlotter3D
1174+
11731175
return OrbitPlotter3D().plot(self, label=label)
11741176
else:
1177+
from poliastro.plotting.core import OrbitPlotter2D
1178+
11751179
return OrbitPlotter2D().plot(self, label=label)

0 commit comments

Comments
 (0)