-
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.
- Loading branch information
1 parent
db60f51
commit 5223151
Showing
1 changed file
with
118 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,118 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Animation Plot" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"import matplotlib.animation as animation\n", | ||
"\n", | ||
"\n", | ||
"def update(num, data, line):\n", | ||
" line.set_data(data[...,:num])\n", | ||
" return line," | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fig1 = plt.figure()\n", | ||
"\n", | ||
"\n", | ||
"x = np.arange(1,26)\n", | ||
"y = np.arange(1,26)\n", | ||
"data = np.vstack((x,y)) #stacking two arrays into one which is passed as argument for update_line function\n", | ||
"\n", | ||
"\n", | ||
"l, = plt.plot([],[])\n", | ||
"print(type(l))\n", | ||
"plt.xlim(1, 26)\n", | ||
"plt.ylim(1,26)\n", | ||
"\n", | ||
"line_ani = animation.FuncAnimation(fig1, update, 25, fargs=(data, l),\n", | ||
" interval=50, blit=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"line_ani.save('lines.gif') # saves the animated plot to gif" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"#### HeatMap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import seaborn as sns\n", | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"flights = sns.load_dataset(\"flights\")\n", | ||
"\n", | ||
"flights = flights.pivot(\"month\", \"year\", \"passengers\")\n", | ||
"plt.figure(figsize = (80,80))\n", | ||
"sns.heatmap(flights, cmap = 'icefire_r', cbar = False, xticklabels=False, yticklabels = False)" | ||
] | ||
}, | ||
{ | ||
"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.7.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |