[Matplotlib-users] Attempting to get animated plot to work in this example

Samuel Dupree sdupree at computational-astronomer.com
Fri Apr 22 13:07:45 EDT 2016


I'm running matplotlib ver. 1.5.1 in an anaconda distribution on a 
MacBook Pro running Mac OS X ver. 10.11.4 (El Capitan). I'm attempting 
to get the animation portion of the example attached to this note 
running. I've looked through the on-line documentation on plot() and 
plot3d() but have turned up empty.

Any thoughts.

Sam Dupree.


-------------- next part --------------
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from numpy           import radians
from scipy.constants import kilo

from orbital         import earth, KeplerianElements, Maneuver, plot, plot3d

import matplotlib.pyplot           as     plt

plt.switch_backend('QT4Agg')


# Create molniya orbit from period and eccentricity
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)


# Simple circular orbit
orbit = KeplerianElements.with_altitude(1000 * kilo, body=earth)


## Simple plots
plot(molniya)

plot3d(molniya)


## Animation
plot(molniya, title='Molniya 1', animate=True)

plot3d(molniya, title='Molniya 2', animate=True)


## Maneuvers
man = Maneuver.hohmann_transfer_to_altitude(10000 * kilo)

plot(orbit, title='Maneuver 1', maneuver=man)

plot3d(orbit, title='Maneuver 2', maneuver=man)

import matplotlib.pyplot as plt
plt.show()



More information about the Matplotlib-users mailing list