{ "nbformat_minor": 0, "nbformat": 4, "cells": [ { "execution_count": null, "cell_type": "code", "source": [ "%matplotlib inline" ], "outputs": [], "metadata": { "collapsed": false } }, { "source": [ "\nImshow elaborate\n=================\n\nAn example demoing imshow and styling the figure.\n\n" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "import numpy as np\nimport matplotlib.pyplot as plt\n\ndef f(x, y):\n return (1 - x / 2 + x ** 5 + y ** 3 ) * np.exp(-x ** 2 - y ** 2)\n\nn = 10\nx = np.linspace(-3, 3, 3.5 * n)\ny = np.linspace(-3, 3, 3.0 * n)\nX, Y = np.meshgrid(x, y)\nZ = f(X, Y)\n\nplt.axes([0.025, 0.025, 0.95, 0.95])\nplt.imshow(Z, interpolation='nearest', cmap='bone', origin='lower')\nplt.colorbar(shrink=.92)\n\nplt.xticks(())\nplt.yticks(())\nplt.show()" ], "outputs": [], "metadata": { "collapsed": false } } ], "metadata": { "kernelspec": { "display_name": "Python 2", "name": "python2", "language": "python" }, "language_info": { "mimetype": "text/x-python", "nbconvert_exporter": "python", "name": "python", "file_extension": ".py", "version": "2.7.12", "pygments_lexer": "ipython2", "codemirror_mode": { "version": 2, "name": "ipython" } } } }