Skip to content

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

@Lucaspec72

Description

@Lucaspec72

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions