Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Adding two new styles to mplstyles #3190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 12, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions examples/style_sheets/plot_bmh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
This example demonstrates the "bmh" style, which is the design used in the
Bayesian Methods for Hackers online book.
"""
from numpy.random import beta
import matplotlib.pyplot as plt

plt.style.use('bmh')


def plot_beta_hist(a, b):
plt.hist(beta(a, b, size=10000), histtype="stepfilled",
bins=25, alpha=0.8, normed=True)
return

plot_beta_hist(10, 10)
plot_beta_hist(4, 12)
plot_beta_hist(50, 12)
plot_beta_hist(6, 55)

plt.show()
18 changes: 18 additions & 0 deletions examples/style_sheets/plot_fivethirtyeight.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
This shows an example of the "fivethirtyeight" styling, which
tries to replicate the styles from FiveThirtyEight.com.
"""


from matplotlib import pyplot as plt
import numpy as np

x = np.linspace(0, 10)

with plt.style.context('fivethirtyeight'):
plt.plot(x, np.sin(x) + x + np.random.randn(50))
plt.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50))
plt.plot(x, np.sin(x) + 2 * x + np.random.randn(50))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script should end with a plt.show() call.


plt.show()
22 changes: 22 additions & 0 deletions lib/matplotlib/style/stylelib/bmh.mplstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#Author: Cameron Davidson-Pilon, original styles from Bayesian Methods for Hackers
# https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/

lines.linewidth : 2.0

patch.linewidth: 0.5
patch.facecolor: blue
patch.edgecolor: eeeeee
patch.antialiased: True

text.hinting_factor : 8

mathtext.fontset : cm

axes.facecolor: eeeeee
axes.edgecolor: bcbcbc
axes.grid : True
axes.titlesize: x-large
axes.labelsize: large
axes.color_cycle: 348ABD, A60628, 7A68A6, 467821, D55E00, CC79A7, 56B4E9, 009E73, F0E442, 0072B2

legend.fancybox: True
40 changes: 40 additions & 0 deletions lib/matplotlib/style/stylelib/fivethirtyeight.mplstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#Author: Cameron Davidson-Pilon, replicated styles from FiveThirtyEight.com
# See https://www.dataorigami.net/blogs/fivethirtyeight-mpl

lines.linewidth: 4
lines.solid_capstyle: butt

legend.fancybox: true

axes.color_cycle: 30a2da, fc4f30, e5ae38, 6d904f, 8b8b8b
axes.facecolor: f0f0f0
axes.labelsize: large
axes.axisbelow: true
axes.grid: true
axes.edgecolor: f0f0f0
axes.linewidth: 3.0
axes.titlesize: x-large

patch.edgecolor: f0f0f0
patch.linewidth: 0.5

svg.fonttype: path

grid.linestyle: -
grid.linewidth: 1.0
grid.color: cbcbcb

xtick.major.size: 0
xtick.minor.size: 0
ytick.major.size: 0
ytick.minor.size: 0

font.size:14.0

savefig.edgecolor: f0f0f0
savefig.facecolor: f0f0f0

figure.subplot.left: 0.08
figure.subplot.right: 0.95
figure.subplot.bottom: 0.07
figure.facecolor: f0f0f0