{
"metadata": {
"name": "",
"signature": "sha256:2ed3a4196a002833571beec9d57032621bf7f00f085f2c749df7c623d625a0e2"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# matploblib style Demo\n",
"[matploblib](http://matplotlib.org/) [added a style package in 1.4.2](http://matplotlib.org/1.4.2/users/whats_new.html#style-package-added). Here's a quick view of how these styles look."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%matplotlib inline\n",
"from matplotlib import style\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"xs = np.linspace(-5, 5, 1000)\n",
"ys = np.cos(xs)\n",
"print(style.available)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[u'dark_background', u'bmh', u'grayscale', u'ggplot', u'fivethirtyeight']\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Default"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"plt.plot(xs, ys, label='$sin(x)$')\n",
"plt.legend()\n",
"plt.grid()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"\n",
"\n",
"\n",
"\n"
],
"text": [
""
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## dark_background"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"style.use('dark_background')\n",
"plt.plot(xs, ys, label='$sin(x)$')\n",
"plt.legend()\n",
"plt.grid()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"\n",
"\n",
"\n",
"\n"
],
"text": [
""
]
}
],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## bmh"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"style.use('bmh')\n",
"plt.plot(xs, ys, label='$sin(x)$')\n",
"plt.legend()\n",
"plt.grid()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"\n",
"\n",
"\n",
"\n"
],
"text": [
""
]
}
],
"prompt_number": 5
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## grayscale"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"style.use('grayscale')\n",
"plt.plot(xs, ys, label='$sin(x)$')\n",
"plt.legend()\n",
"plt.grid()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"\n",
"\n",
"\n",
"\n"
],
"text": [
""
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## ggplot"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"style.use('ggplot')\n",
"plt.plot(xs, ys, label='$sin(x)$')\n",
"plt.legend()\n",
"plt.grid()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"\n",
"\n",
"\n",
"\n"
],
"text": [
""
]
}
],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"## fivethiryeight"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 8
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"style.use('fivethirtyeight')\n",
"plt.plot(xs, ys, label='$sin(x)$')\n",
"plt.legend()\n",
"plt.grid()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"\n",
"\n",
"\n",
"\n"
],
"text": [
""
]
}
],
"prompt_number": 9
}
],
"metadata": {}
}
]
}