Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with plotting - doesn't show anything unless plt.show() is called, and orbit rendering issues #27

Open
Lucaspec72 opened this issue Jul 27, 2023 · 0 comments

Comments

@Lucaspec72
Copy link

It seems that plot/plot2d and plot3d do not display anything, i've tried the following :

from numpy import radians
from scipy.constants import kilo
from orbital import earth, KeplerianElements, Maneuver, plot, plot3d
from orbital import earth_sidereal_day
molniya = KeplerianElements.with_period(
    earth_sidereal_day / 2, e=0.741, i=radians(63.4), arg_pe=radians(270),
    body=earth)

orbit = KeplerianElements.with_altitude(1000 * kilo, body=earth)
plot3d(molniya, title='Molniya 1', animate=True)

and got this :

C:\Users\Lucaspec72\AppData\Local\Programs\Python\Python310\lib\site-packages\matplotlib\animation.py:884: UserWarning: Animation was deleted without rendering anything. This is most likely not intended. To prevent deletion, assign the Animation to a variable, e.g. `anim`, that exists until you output the Animation using `plt.show()` or `anim.save()`.
  warnings.warn(

i've managed to make it display by loading in matplotlib.pyplot and adding a plt.show(), but animations don't work (makes sense, since it seems like they're handled by Plotter2D and Plotter3D)

from numpy import radians
from scipy.constants import kilo
from orbital import earth, KeplerianElements, Maneuver, plot, plot3d
from orbital import earth_sidereal_day
import matplotlib.pyplot as plt #added
molniya = KeplerianElements.with_period(
    earth_sidereal_day / 2, e=0.741, i=radians(63.4), arg_pe=radians(270),
    body=earth)

orbit = KeplerianElements.with_altitude(1000 * kilo, body=earth)
plot3d(molniya, title='Molniya 1', animate=True)
plt.show() #added

(pointer doesn't move)
image
additionally, the orbit isn't properly rendered, and is hidden whenever overlapping with a planet, regardless of whether or not it's in front or behind it. That being said, this doesn't seem to happen on the screenshots in the documentation (https://pythonhosted.org/OrbitalPy/examples/plotting/plotting/#maneuvers) so it might be a side effect of displaying using plt.show.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant