Skip to content

Instantly share code, notes, and snippets.

@CamDavidsonPilon
Last active December 19, 2015 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CamDavidsonPilon/5889614 to your computer and use it in GitHub Desktop.
Save CamDavidsonPilon/5889614 to your computer and use it in GitHub Desktop.
Make cover go now
%pylab
import scipy.stats as stats
print "Best to use custom matplotlibrc located in /styles directory of BMH project."
figure( figsize= ( 8, 11 ) )
#means = np.random.uniform( -4, 4, size = 5 )
means = np.array([ 3.90933614, -1.15148996, 1.70045292, -3.27613385, -0.71058847])
std = [0.5, .3, 1, .7, 2]
#params = [ (0, 0.5), (3, .3), (2,1), (-3, .7 ), (-1, 2 ) ]
params = zip( means, std )
x = np.linspace(-5, 5, 250 )
norm = stats.norm
N = 1500
colors = ["#348ABD", "#A60628", "#7A68A6", "#467821","#D55E00"]
i=0
for m, s in params:
y = norm.pdf( x, m ,scale = s )
plot( x, y, lw = 6, alpha = 0.8)
plt.scatter(norm.rvs(m ,scale = 1.1*s, size = N ), 1.5*np.random.beta(1,9*s,N) , c = colors[i], alpha = .2, s = 50 )
i+=1
plt.text( 4.9,1.27, "Probabilistic Programming &\nBayesian Methods \nfor Hackers",
fontsize=30, alpha = 0.4, horizontalalignment = "right" )
plt.text( 4.9,1.27, "\nBayesian Methods \nfor Hackers",
fontsize=30, alpha = 0.5, horizontalalignment = "right" )
#plt.xticks([])
plt.yticks(np.linspace(0, 1.5, 6), 6*[""])
plt.xticks(np.linspace(-5, 5, 10), 10*[""]);
xlim(-5,5)
ylim( .007,1.5)
plt.savefig( "cover.png", bbox_inches = "tight", pad_inches=0 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment