Last active
February 9, 2020 08:34
-
-
Save mu-777/90e21e044ccef055008f6b92c67f8c97 to your computer and use it in GitHub Desktop.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.jupyter.widget-view+json": { | |
"model_id": "703d74c9cf454f5fb9e2a3c3f4c2ab73" | |
} | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"<function __main__.scatter>" | |
] | |
}, | |
"execution_count": 1, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"%matplotlib inline\n", | |
"# %matplotlib notebook\n", | |
"\n", | |
"from mpl_toolkits.mplot3d import Axes3D\n", | |
"import matplotlib.pyplot as plt\n", | |
"import numpy as np\n", | |
"from ipywidgets import interact\n", | |
"\n", | |
"fig = plt.figure()\n", | |
"ax = fig.gca(projection='3d')\n", | |
"\n", | |
"def scatter(num_data):\n", | |
" x = range(num_data)\n", | |
" y = [np.sin(t/10.0) for t in x]\n", | |
" z = [np.cos(t/10.0) for t in x]\n", | |
" plt.gcf().gca(projection='3d').plot(x, y, z, 'o',color='C3')\n", | |
" plt.show()\n", | |
"\n", | |
"interact(scatter, num_data=(1, 300, 1))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.7" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment