From interactive exploration to publication quality graphics John
From interactive exploration to publication quality graphics John Hunter & Fernando Perez jdh 2358@gmail. com Siam Python in Scientific Computing 2011
Talk outline Matplotlib in the wild The simple plot Beyond the simple plot (underutilized features, animations, event handling, mpl in the browser) Siam Python in Scientific Computing 2011
Matplotlib in the wild Siam Python in Scientific Computing 2011
nipy: pbrain: the first matplotlib application Siam Python in Scientific Computing 2011
Matplotlib in the wild: NOAA basemap toolkit (courtesy of NOAA) Siam Python in Scientific Computing 2011
basemap toolkit cylindrical equidistant, mercator, lambert conformal conic, lambert azimuthal equal area, albers equal area conic and stereographic. Siam Python in Scientific Computing 2011
Matplotlib in the wild: Finance industry Siam Python in Scientific Computing 2011
Matplotlib in the wild: Hubble Space Telescope Siam Python in Scientific Computing 2011
Siam Python in Scientific Computing 2011
The simple plot Siam Python in Scientific Computing 2011
matplotlib 3 ways embedding in a webserver or application (Tk, GTK, WX, Qt, FLTK, macosx, HTML 5) production scripting interactive shell (pylab / pyplot) Siam Python in Scientific Computing 2011
Copy the great architectures E Tufte Siam Python in Scientific Computing 2011
Simple pylab demo: subplots and sharex Siam Python in Scientific Computing 2011
Beyond the simple plot Dropped spines, annotations, paths Animating figures and making movie Interacting with figures and data Making production documentation in Sphinx with math, plots and ipython http: //matplotlib. sourceforge. net/sampledoc/ Siam Python in Scientific Computing 2011
matplotlib API Siam Python in Scientific Computing 2011
Beyond the simple plot: paths Siam Python in Scientific Computing 2011
Beyond the simple plot: annotations Siam Python in Scientific Computing 2011
Beyond the simple plot: dropped spines Siam Python in Scientific Computing 2011
Beyond the simple plot Custom projections http: //matplotlib. sourceforge. net/examples/api/custom_projection_example. html Siam Python in Scientific Computing 2011
Proper La. Te. X, builtin Siam Python in Scientific Computing 2011
Text: just a path Siam Python in Scientific Computing 2011
Matplotlib animations Tutorial on underlying machinery http: //www. scipy. org/Cookbook/Matplotlib/Animations New animations API in github (to be released soon) or available with older matplotlib by downloading one file https: //github. com/matplotlib/blob/master/lib/matplotlib/animation. py Siam Python in Scientific Computing 2011
Animations: Func. Animation Siam Python in Scientific Computing 2011
Animations: using generators for instrument monitoring Siam Python in Scientific Computing 2011
Interactive demo: matplotlib animations Siam Python in Scientific Computing 2011
Matplotlib events GUI neutral event handling Used to insulate matplotlib internally from the user interface toolkits for panning, zooming, etc. Battle tested and robust Available to user API to support interaction with figure and data. Write interaction code once, plug into any user interface mpl supports (Tk, GTK, QT, WX, Cocoa, FLTK) Simple callback API Siam Python in Scientific Computing 2011
Matplotlib events A sample event: Mouse. Event Siam Python in Scientific Computing 2011
Sampling of matplotlib events button_press_event Mouse. Event - mouse button is pressed button_release_event Mouse. Event - mouse button is released draw_event Draw. Event - canvas draw key_press_event Key. Event - key is pressed key_release_event Key. Event - key is released motion_notify_event Mouse. Event - mouse motion pick_event is selected Pick. Event - an object in the canvas resize_event Resize. Event - figure canvas is resized scroll_event rolled Mouse. Event - mouse scroll wheel is figure_enter_event Location. Event - mouse enters a new figure_leave_event Location. Event - mouse leaves a figure axes_enter_event Location. Event - mouse enters a new axes_leave_event Location. Event - mouse leaves an axes Siam Python in Scientific Computing 2011
Interactive demo: matplotlib events Siam Python in Scientific Computing 2011
- Slides: 29