Skip to content

Instantly share code, notes, and snippets.

@dajobe
Created February 1, 2011 18:19
Show Gist options
  • Save dajobe/806316 to your computer and use it in GitHub Desktop.
Save dajobe/806316 to your computer and use it in GitHub Desktop.
Strata big data bootcamp matplotlib work in debian
Debian way to do the data bootcamp matplotlib work
Install packages
$ sudo apt-get install python-matplotlib python-scipy
NOTE 1: You MUST have X running and DISPLAY set for the plt.plot step.
NOTE 2: Slides have a typo. Use random_numbers for both lines
Render:
$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pylab as plt
>>> from scipy.stats import norm
>>> random_numbers = norm.rvs(0,1,size=10000)
>>> n, bins, pataches = plt.hist(random_numbers,normed=True,bins=25, alpha=0.75)>>> y = norm.pdf(bins)
>>> plt.plot(bins,y,"r-")
[<matplotlib.lines.Line2D object at 0x9cde1ac>]
>>> plt.xlabel("Random numbers")
<matplotlib.text.Text object at 0x9cdebcc>
>>> plt.ylabel("Density")
<matplotlib.text.Text object at 0x9ce488c>
>>> plt.title("My first matplotlib visualization!")
<matplotlib.text.Text object at 0x9ceb5cc>
>>> plt.savefig("matplotlib_first.png")
>>>
and that dumps a matplotlib_first.png in your dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment