Removed need for matplotlibs 538 style.

I got the original code from the author, Cameron Davidson-Pilon,
modified it for the minor changes I make for the book, and put it
in 538.json. The main gain is that somebody doesn't need bleeding
edge matplotlib installed to get the 538 look.
This commit is contained in:
Roger Labbe 2014-12-22 13:34:50 -08:00
parent 8eaa6ee693
commit 9e6c6ffb5f
3 changed files with 78 additions and 74 deletions

File diff suppressed because one or more lines are too long

40
code/538.json Normal file
View File

@ -0,0 +1,40 @@
{
"lines.linewidth": 2.0,
"examples.download": true,
"patch.linewidth": 0.5,
"legend.fancybox": true,
"axes.color_cycle": [
"#30a2da",
"#fc4f30",
"#e5ae38",
"#6d904f",
"#8b8b8b"
],
"axes.facecolor": "#f0f0f0",
"axes.labelsize": "large",
"axes.axisbelow": true,
"axes.grid": true,
"patch.edgecolor": "#f0f0f0",
"axes.titlesize": "x-large",
"svg.embed_char_paths": "path",
"examples.directory": "",
"figure.facecolor": "#f0f0f0",
"grid.linestyle": "-",
"grid.linewidth": 1.0,
"grid.color": "#cbcbcb",
"axes.edgecolor":"#f0f0f0",
"xtick.major.size": 0,
"xtick.minor.size": 0,
"ytick.major.size": 0,
"ytick.minor.size": 0,
"axes.linewidth": 3.0,
"font.size":14.0,
"lines.linewidth": 2,
"lines.solid_capstyle": "butt",
"savefig.edgecolor": "#f0f0f0",
"savefig.facecolor": "#f0f0f0",
"figure.subplot.left" : 0.08,
"figure.subplot.right" : 0.95,
"figure.subplot.bottom" : 0.07,
"figure.subplot.hspace" : 0.5
}

View File

@ -2,7 +2,7 @@
from IPython.core.display import HTML
import matplotlib.pylab as pylab
import matplotlib.pyplot as plt
import json
def test_filterpy_version():
import filterpy
@ -38,43 +38,7 @@ def equal_axis():
def reset_axis():
pylab.rcParams['figure.figsize'] = 12, 6
try:
plt.style.use('fivethirtyeight')
reset_axis ()
pylab.rcParams['lines.linewidth'] = 2
pylab.rcParams['figure.subplot.hspace'] = 0.5
except:
pylab.rcParams['lines.linewidth'] = 2
pylab.rcParams['lines.antialiased'] = True
pylab.rcParams['patch.linewidth'] = 0.5
pylab.rcParams['patch.facecolor'] = '348ABD' #blue
pylab.rcParams['patch.edgecolor'] = 'eeeeee'
pylab.rcParams['patch.antialiased'] = True
pylab.rcParams['font.family'] = 'monospace'
pylab.rcParams['font.size'] = 12.0
#pylab.rcParams['font.monospace'] = 'Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace'
pylab.rcParams['axes.facecolor'] = 'E5E5E5'
pylab.rcParams['axes.edgecolor'] = 'bcbcbc'
pylab.rcParams['axes.linewidth'] = 1
pylab.rcParams['axes.grid'] = True
pylab.rcParams['axes.titlesize'] = 'x-large'
pylab.rcParams['axes.labelsize'] = 'large'
pylab.rcParams['axes.labelcolor'] = '555555'
pylab.rcParams['axes.axisbelow'] = True
pylab.rcParams['axes.color_cycle'] = '004080, 8EBA42, E24A33, 348ABD, 777760, 988ED5, FDC15E'
pylab.rcParams['xtick.major.pad'] = 6
pylab.rcParams['xtick.minor.size'] = 0
pylab.rcParams['xtick.minor.pad'] = 6
pylab.rcParams['xtick.color'] = '555555'
pylab.rcParams['ytick.direction'] = 'in'
pylab.rcParams['legend.fancybox'] = True
pylab.rcParams['figure.facecolor'] = '1.0'
pylab.rcParams['figure.edgecolor'] = '0.50'
pylab.rcParams['figure.subplot.hspace'] = 0.5
pylab.rcParams['figure.figsize'] = 12,6
pylab.rcParams['grid.color'] = 'ffffff'
pylab.rcParams['grid.linestyle'] = 'solid'
pylab.rcParams['grid.linewidth'] = 1.5
s = json.load( open("../code/538.json") )
plt.rcParams.update(s)
reset_axis ()