{ "nbformat_minor": 0, "nbformat": 4, "cells": [ { "execution_count": null, "cell_type": "code", "source": [ "%matplotlib inline" ], "outputs": [], "metadata": { "collapsed": false } }, { "source": [ "\nLinestyles\n==========\n\nPlot the different line styles.\n\n" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "import numpy as np\nimport matplotlib.pyplot as plt\n\ndef linestyle(ls, i):\n X = i * .5 * np.ones(11)\n Y = np.arange(11)\n plt.plot(X, Y, ls, color=(.0, .0, 1, 1), lw=3, ms=8,\n mfc=(.75, .75, 1, 1), mec=(0, 0, 1, 1))\n plt.text(.5 * i, 10.25, ls, rotation=90, fontsize=15, va='bottom')\n\nlinestyles = ['-', '--', ':', '-.', '.', ',', 'o', '^', 'v', '<', '>', 's',\n '+', 'x', 'd', '1', '2', '3', '4', 'h', 'p', '|', '_', 'D', 'H']\nn_lines = len(linestyles)\n\nsize = 20 * n_lines, 300\ndpi = 72.0\nfigsize= size[0] / float(dpi), size[1] / float(dpi)\nfig = plt.figure(figsize=figsize, dpi=dpi)\nplt.axes([0, 0.01, 1, .9], frameon=False)\n\nfor i, ls in enumerate(linestyles):\n linestyle(ls, i)\n\nplt.xlim(-.2, .2 + .5*n_lines)\nplt.xticks(())\nplt.yticks(())\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" } } } }