Skip to content

Commit

Permalink
Creation of the final project repository
Browse files Browse the repository at this point in the history
  • Loading branch information
gadgethm committed Dec 7, 2016
0 parents commit 7533e52
Show file tree
Hide file tree
Showing 4 changed files with 12,651 additions and 0 deletions.
91 changes: 91 additions & 0 deletions Untitled.ipynb
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
}
Loading

0 comments on commit 7533e52

Please sign in to comment.