-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creation of the final project repository
- Loading branch information
0 parents
commit 7533e52
Showing
4 changed files
with
12,651 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# First import everthing you need\n", | ||
"import numpy as np\n", | ||
"from matplotlib import pyplot as plt\n", | ||
"from matplotlib import animation\n", | ||
"from mpl_toolkits.mplot3d import Axes3D\n", | ||
"\n", | ||
"# Create some random data, I took this piece from here:\n", | ||
"# http://matplotlib.org/mpl_examples/mplot3d/scatter3d_demo.py\n", | ||
"def randrange(n, vmin, vmax):\n", | ||
" return (vmax - vmin) * np.random.rand(n) + vmin\n", | ||
"n = 100\n", | ||
"xx = randrange(n, 23, 32)\n", | ||
"yy = randrange(n, 0, 100)\n", | ||
"zz = randrange(n, -50, -25)\n", | ||
"\n", | ||
"# Create a figure and a 3D Axes\n", | ||
"fig = plt.figure()\n", | ||
"ax = Axes3D(fig)\n", | ||
"\n", | ||
"# Create an init function and the animate functions.\n", | ||
"# Both are explained in the tutorial. Since we are changing\n", | ||
"# the the elevation and azimuth and no objects are really\n", | ||
"# changed on the plot we don't have to return anything from\n", | ||
"# the init and animate function. (return value is explained\n", | ||
"# in the tutorial.\n", | ||
"def init():\n", | ||
" ax.scatter(xx, yy, zz, marker='o', s=120, c=\"goldenrod\",alpha=1.0)\n", | ||
" return ()\n", | ||
"\n", | ||
"def animate(i):\n", | ||
" ax.view_init(elev=0.1*i+10, azim=i)\n", | ||
" return ()\n", | ||
" \n", | ||
"# Animate\n", | ||
"anim = animation.FuncAnimation(fig, animate, init_func=init,\n", | ||
" frames=360, interval=20, blit=True)\n", | ||
"# Save\n", | ||
"anim.save('basic_animation.mp4', writer='avconv',fps=30, extra_args=['-vcodec', 'libx264'])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 2", | ||
"language": "python", | ||
"name": "python2" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.11" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.