Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introducing Tim Sheerman-Chase This work is licensed under a Creative Commons Attribution 3.0 Unported License 28 th Sept 2011.

Similar presentations


Presentation on theme: "Introducing Tim Sheerman-Chase This work is licensed under a Creative Commons Attribution 3.0 Unported License 28 th Sept 2011."— Presentation transcript:

1 Introducing Tim Sheerman-Chase This work is licensed under a Creative Commons Attribution 3.0 Unported License 28 th Sept 2011

2 Overview matplotlib is a high quality plotting tool Depends on: Can be used via command line, by a script or by a GUI program Alternatives: gnuplot or matlab Easy to use, free software, customisable Project web page: http://matplotlib.sourceforge.net/

3 How To Use matplotlib pylab is a quick way to start python with: numpy (low level maths) scipy (high level maths) matplotlib (figure plotting) Everything in one namespace (yikes!) Quick start, plot 100 histogram of 10000 samples of a normal distribution ipython -pylab x = randn(10000) hist(x,100) Start pylab from linux shell Use numpy to get 10000 samples Plot histogram

4 Histogram Result matplotlib can save vector formatted graphs to SVG or PDF

5 Simple Line Plot with Latex Labels plot([1,3,2,4]) title('Time dependency of Foo') xlabel('Time (sec)') ylabel(r'Observed Value $Z^{a}_{b}$') grid(True)

6 Scatter Plot with Legend x = arange(0.,2.*math.pi,0.2) print "Shape of x",x.shape plot(x, sin(x), 'o', label="sin(x)") plot(x, cos(x), 'x', label="cos(x)") legend() savefig("plot.svg")

7 Annotations annotate('Intercept', xy=(math.pi,0), xytext=(3.5,0.5), arrowprops=dict(facecolor='black'))

8 Final Word View the matplotlib gallery for inspiration Any questions?


Download ppt "Introducing Tim Sheerman-Chase This work is licensed under a Creative Commons Attribution 3.0 Unported License 28 th Sept 2011."

Similar presentations


Ads by Google