{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# pcolormesh" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import animatplot as amp\n", "\n", "x = np.linspace(-2, 2, 50)\n", "y = np.linspace(-2, 2, 50)\n", "t = np.linspace(0, 2 * np.pi, 40)\n", "\n", "X, Y, T = np.meshgrid(x, y, t)\n", "\n", "Z = np.sin(X * X + Y * Y - T)\n", "\n", "block = amp.blocks.Pcolormesh(X[:, :, 0], Y[:, :, 0], Z, t_axis=2, cmap=\"RdBu\")\n", "plt.colorbar(block.quad)\n", "plt.gca().set_aspect(\"equal\")\n", "\n", "anim = amp.Animation([block], amp.Timeline(t))\n", "\n", "anim.controls()\n", "\n", "anim.save_gif(\"pcolormesh\")\n", "plt.show()" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ".. image:: pcolormesh.gif" ] } ], "metadata": { "celltoolbar": "Raw Cell Format", "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.6" } }, "nbformat": 4, "nbformat_minor": 2 }