Created
April 13, 2015 15:05
-
-
Save germannp/ec179f032cc4c97ee487 to your computer and use it in GitHub Desktop.
Matplotlib script to create a rotating animation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Save frames from different POVs""" | |
import os | |
import numpy as np | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
from mpl_toolkits.mplot3d import Axes3D | |
import innear | |
# Set up plot | |
worm = pd.DataFrame({'x': np.random.randn(500), | |
'y': np.random.randn(500), | |
'z': np.random.randn(500)*5}) | |
sns.set(style='white') | |
ax = plt.subplot(1,1,1, projection='3d') | |
ax.scatter(worm['x'], worm['y'], worm['z']) | |
innear.equalize_axis3d(ax) | |
ax.view_init(elev=0) | |
ax.axis('off') | |
# Rotation | |
delev = 30 | |
for elevation in np.arange(-delev, 181, delev): | |
ax.view_init(elev=elevation) | |
plt.savefig('rotanim_' + str(elevation) + '.png') | |
# That is pretty pedestrian -- but the first axes suck :> | |
os.remove('rotanim_' + str(-delev) + '.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment