Skip to content

Instantly share code, notes, and snippets.

@kghose
Created July 27, 2011 15:04
Show Gist options
  • Save kghose/1109557 to your computer and use it in GitHub Desktop.
Save kghose/1109557 to your computer and use it in GitHub Desktop.
Illustrates a small onscreen display bug in matplotlib hist
import pylab
sigma=.1
pylab.figure(figsize=(12,3))
r = pylab.randn(1000000)*sigma
pylab.hist(r,bins=200,range=[-3,3],normed=True, align='mid',histtype='stepfilled',color='gray')
x = pylab.linspace(-3,3,200)
y = (1./(2*pylab.pi*sigma**2)**.5)*pylab.exp(-x**2/(2*sigma**2))
pylab.plot(x,y,'k')
pylab.setp(pylab.gca(), xlim=[-3,3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment