{ "nbformat_minor": 0, "nbformat": 4, "cells": [ { "execution_count": null, "cell_type": "code", "source": [ "%matplotlib inline" ], "outputs": [], "metadata": { "collapsed": false } }, { "source": [ "\nGrid\n====\n\nDisplaying a grid on the axes in matploblib.\n\n" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "import matplotlib.pyplot as plt\n\nax = plt.axes([0.025, 0.025, 0.95, 0.95])\n\nax.set_xlim(0,4)\nax.set_ylim(0,3)\nax.xaxis.set_major_locator(plt.MultipleLocator(1.0))\nax.xaxis.set_minor_locator(plt.MultipleLocator(0.1))\nax.yaxis.set_major_locator(plt.MultipleLocator(1.0))\nax.yaxis.set_minor_locator(plt.MultipleLocator(0.1))\nax.grid(which='major', axis='x', linewidth=0.75, linestyle='-', color='0.75')\nax.grid(which='minor', axis='x', linewidth=0.25, linestyle='-', color='0.75')\nax.grid(which='major', axis='y', linewidth=0.75, linestyle='-', color='0.75')\nax.grid(which='minor', axis='y', linewidth=0.25, linestyle='-', color='0.75')\nax.set_xticklabels([])\nax.set_yticklabels([])\n\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" } } } }