Matplotlib: from brain surgery to rocket science John D. Hunter, Ph.D. Perry Greenfield, Ph.D.

Slides:



Advertisements
Similar presentations
McGraw-Hill/Irwin The O’Leary Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Lab 2 Charting Worksheet Data.
Advertisements

Week 7 Web Typography. 2 Understanding Type Design Principles.
Matplotlib: DANSE kickoff John D. Hunter, Ph.D.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall1 Exploring Microsoft Office Excel Copyright © 2008 Prentice-Hall. All rights.
MATLAB Week 3 17 November Outline Graphics – Basic plotting – Editing plots from GUI – Editing plots from m-file – Advanced plotting commands.
IS&T Scientific Visualization Tutorial – Spring 2010 Robert Putnam Plotting packages overview.
Python plotting for lab folk Only the stuff you need to know to make publishable figures of your data. For all else: ask Sourish.
–Streamline / organize Improve readability of code Decrease code volume/line count Simplify mechanisms Improve maintainability & clarity Decrease development.
Web Design – Sec 4-6 and 4-7 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Abstract # 0000 Make the Main Title with Large Bold Type Your Name Here Your Department Here Texas A&M Health Science Center Make the Main Title with Large.
An introduction to Plotting in MATLAB Rikard Johansson Department of Biomedical Engineering (IMT) Linköping University
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse 2.
DICOM Standards Committee Status Update: Conversion of DICOM figures to xml electronic format RSNA 2007 November 29, 2007 James J. Rogers Coastal Consulting.
Chapter 5 Review: Plotting Introduction to MATLAB 7 Engineering 161.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
MLOSS: Whistler 2008 scientific visualisation for python John Hunter Tradelink Chicago
PLOTS AND FIGURES DAVID COOPER SUMMER Plots One of the primary uses for MATLAB is to be able to create publication quality figures from you data.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Copyright © 2008 Prentice-Hall. All rights reserved. Committed to Shaping the Next Generation.
C51BR Applications of Spreadsheets 1 Chapter 16 Getting Started Making Charts.
Abstract # 0000 Make the Main Title with Large Bold Type Use Smaller Type for the Subtitle. Above Type is 105pt. This Type is 70pt. Make authors’ names.
Java Analysis Studio Status Update 12 May 2000 Altas Software Week Tony Johnson
JAS3 + AIDA LC Simulations Workshop SLAC 19 th May 2003.
Company Overview for GDF Suez December 29, Enthought’s Business Enthought provides products and consulting services for scientific software solutions.
SPACE TELESCOPE SCIENCE INSTITUTE Operated for NASA by AURA COS Pipeline Language(s) We plan to develop CALCOS using Python and C Another programming language?
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 11 Copyright © 2008 Prentice-Hall. All rights reserved. Chapter 3: Charts: Delivering a Message.
GMT: The Generic Mapping Tools Paul Wessel, Walter H.F. Smith and the GMT team.
Views The architecture was specifically changed to accommodate multiple views. The used of the QStackedWidget makes it easy to switch between the different.
Linux Audio Mangler Project Final Presentation Yu Chong Hector Urtubia Tony Zuliani.
Examples of different formulas and their uses....
Chapter 03: Lecture Notes (CSIT 104) 11 Chapter 3 Charts: Delivering a Message Exploring Microsoft Office Excel 2007.
Parallel Interactive Computing with PyTrilinos and IPython Bill Spotz, SNL (Brian Granger, Tech-X Corporation) November 8, 2007 Trilinos Users Group Meeting.
CSC 395 – Software Engineering Lecture 12: Reusability –or– Programming was Bjarne Again.
Open Your Mind to Open Source MPDO’s & EOPR’s Centre for IT & eGovernance AMR-APARD Hyderabad Welcome!
A Picture Is Worth A Thousand Words. DAY 7: EXCEL CHAPTER 4 Tazin Afrin September 10,
ECE 103 Engineering Programming Chapter 40 C Graphing Libraries Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material.
Ch 1. A Python Q&A Session Spring Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.
Python Crash Course Aplpy
Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.
The System on a Chip Company ® LSI LOGIC LSI LOGIC 2/11/ Experiences and Progress with OpenAccess at LSI OpenAccess Interoperability Workshop March.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 11 Copyright © 2008 Prentice-Hall. All rights reserved. Committed to Shaping the Next.
PaPCo, Das2, and Autoplot Jeremy Faden, University of Iowa.
Return to Outline Copyright © 2011 by Maribeth H. Price 3-1 Labeling and annotation.
WIRED 4 An extensible generic Event Display Mark Donszelmann SLAC, Stanford, U.S.A. CHEP2004, 27 september – 1 october Interlaken, Switzerland.
Earth System Modeling Framework Python Interface (ESMP) October 2011 Ryan O’Kuinghttons Robert Oehmke Cecelia DeLuca.
EGR 106 Lecture 6 2-D Plotting Graphical presentation has become the standard method to show technical information. Engineers use plots to analyze, visualize,
GLite build and integration system Building and Packaging Robert HARAKALY
Microsoft® Excel Use the Chart Tools Design tab. 1 Use the Chart Tools Layout and Format tabs. 2 Create chart sheets and chart objects. 3 Edit.
Mantid Stakeholder Review Nick Draper 01/11/2007.
Ch 1. A Python Q&A Session. Why do people use Python? Software Quality Developer productivity Program portability Support Libraries Component integration.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
Fonts. Choosing Fonts How text looks on our web pages is a major component of the overall appearance of our site. We need to choose our text fonts carefully,
CSS FONT STACKS. What are font stacks? Font stacks are about creating a relevant and comprehensive list of fall-back fonts.
Introduction to CASA Crystal Brogan ALMA CASA Subsystem Scientist (NRAO/NAASC) With lots of help from Steve Myers (Project Scientist)
Matplotlib SANTHOSH Boggarapu.
Python & NetworkX Youn-Hee Han
Features of JAS Plots Plots update in real time. Data for plots can be local or remote (use Java RMI to connect to JAS Data Server). Rich variety of styles.
This material is based upon work supported by the U.S. Department of Energy Office of Science under Cooperative Agreement DE-SC Michigan State.
MATLAB ® for Engineers, Holly Moore Fourth Edition, Global Edition © Pearson Education Limited 2015 All rights reserved. Figure 5.1 Simple Plot of Time.
Creating Charts Ms. Hall Spring Using the Insert Tab to Create Charts The Insert tab contains the command groups you’ll use to create charts in.
Python Lab Matplotlib - I Proteomics Informatics, Spring 2014 Week 9 25 th Mar, 2014
Security-Enhanced Linux Stephanie Stelling Center for Information Security Department of Computer Science University of Tulsa, Tulsa, OK
Online Data Monitoring Framework Based on Histogram Packaging in Network Distributed Data Acquisition Systems Tomoyuki Konno 1, Anatael Cabrera 2, Masaki.
Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture.
Introducing Tim Sheerman-Chase This work is licensed under a Creative Commons Attribution 3.0 Unported License 28 th Sept 2011.
Introduction to Visual Basic. NET,. NET Framework and Visual Studio
Lecture 25.
IPYTHON AND MATPLOTLIB Python for computational science
WIRED 4 Event Display Linear Collider Simulation Workshop
Matplotlib and Pandas
Presentation transcript:

Matplotlib: from brain surgery to rocket science John D. Hunter, Ph.D. Perry Greenfield, Ph.D.

brain surgery…

dongle

pbrain

The three stages of python Matlab hell Python purgatory The path to enlightenment

3D python fantastic, but 2D? PyX, ChartDirector, biggles, DISLIN, gnuplot, chaco, xplt, gplt, pyngl, ppgplot, tkinter canvas, gtk- extras, pychart, gist, piddle, graphite…. Multiple plotting idioms Cross platform Publication quality Permissive license Extensible (by me!) Easy plots should be easy (OO not always best) But app embedding should be supported (OO sometimes best) GUI agnosticism The curse of python

# matplotlib 0.1 ~/python/matplot_gtk12> ls README matplotlib.py subplot_demo.py data simple_plot.py view_data.py matplot.py stock_demo.py vline_demo.py # matplotlib python modules 17 files of extension code 44,000 lines of code 130 examples 2-5 active developers at any time; 25 contributors Co-developed with NASA STScI and JPL downloads/month approx 10 messages per/day on mailing list

Copy the great architectures E Tufte

backends

The matplotlib API from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure fig = Figure() canvas = FigureCanvas(fig) ax = fig.add_subplot(111) ax.plot([1,2,3]) a ax.set_title('hi mom') ax.grid(True) ax.set_xlabel('time') ax.set_ylabel('volts') fig.savefig('test')

pylab interface Plotting should just work Easy plots should be easy GUI / interactive complexity should be managed ipython to the rescue IPython _cvs -- An enhanced Interactive Python. ? -> Introduction to IPython's features. %magic -> Information about IPython's 'magic' % functions. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. Welcome to pylab, a matplotlib-based Python environment help(matplotlib) -> generic matplotlib information help(pylab) -> matlab-compatible commands from matplotlib help(plotting) -> plotting commands In [1]: plot([1,2,3])

# Numeric from Numeric import array, where from MLab import std from Numeric import convolve from FFT import fft # numarray from numarray import array, where from numarray.linear_algebra.mlab import std from numarray.convolve import convolve from numarray.fft import fft # matplotlib.numerix from matplotlib.numerix import array, where from matplotlib.numerix.mlab import, mean, std # choose numeric or numarray from the shell C:> python myscript.py --numarray # or in an rc file setting numerix : ‘numarray’ The numerix module

font manager Cross platform font finding: win32, linux, OS X Configurable families: the font engine will pick the best font to match your requirements W3C compliant font.family : sans-serif font.style : normal font.variant : normal font.weight : medium font.stretch : normal font.size : medium font.serif : New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Bitstream Vera Serif, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif font.sans-serif : Lucida Grande, Verdana, Geneva, Lucida,

tex = r'$\cal{R}\prod_{i=\alpha_{i+1}}^\infty a_I … \rm{sin}(2 \pi f x_i)$' text(1, 1.6, tex, fontsize=30) mathtext demo

bar demo

stacked bar

pie demo

scatter demo

histogram demo

log demo

polar demo

layer image

subplot demo

axes demo

legend demo

text alignment

mathtext demo2

cylindrical equidistant, mercator, lambert conformal conic, lambert azimuthal equal area, albers equal area conic and stereographic. basemap toolkit

stock demo

finance demo

MRI with eeg

EEG demo

VTK demo

Did I talk about? Event handling set/set Introspection RC configuration Embedding Dynamic/animated plots Math text Contouring Toolkits / basemap Font management

…from astronomy to zoology? Basic 3D Different colorspaces (CMYK) Arbitrary clipping paths, gradient/pattern fills Unicode support & better TeX support Domain specific toolkits SWF, PDF, Aqua, … Direction fields, arrows, etc

MATPLOTLIB CREDITS (in order of appearance…) Jeremy O'Donoghue wrote the wx backend Andrew Straw provided much of the log scaling architecture, the fill command, PIL support for imshow, and provided many examples Charles Twardy provided the impetus code for the legend class and has made countless bug reports and suggestions for improvement. Gary Ruben made many enhancements to errorbar to support x and y errorbar plots, and added a number of new marker types to plot. John Gill wrote the table class and examples David Moore wrote the paint backend Todd Miller contributed the TkAgg backend and the numerix module, which allows matplotlib to work with either numeric or numarray. He also ported image support to the postscript backend, with much pain and suffering. Paul Barrett overhauled font management to provide an improved, free-standing, platform independent font manager with a WC3 compliant font finder and cache mechanism and ported truetype and mathtext to PS Perry Greenfield overhauled and modernized the goals and priorities page, implemented an improved colormap framework, and has provided many suggestions and a lot of insight to the overall design and organization of matplotlib. Jared Wahlstrand wrote the SVG backend

MATPLOTLIB CREDITS (continued) Steve Chaplin is the GTK maintainer and wrote the Cairo and GTKCairo backends Jim Benson provided the patch to handle vertical mathttext Gregory Lielens provided the FltkAgg backend and several patches for the frontend, including contributions to toolbar2, and support for log ticking with alternate bases and major and minor log ticking Darren Dale did the work to do mathtext exponential labeling for log plots. Paul Mcguire provided the pyparsing module on which mathtext relies, and made a number of optimizations to the matplotlib mathtext grammar. Fernando Perez has provided numerous bug reports and patches for cleaning up backend imports and expanding pylab functionality, and provided matplotlib support in the pylab mode for ipython. He also provided the matshow command. Andrew Dalke of Dalke Scientific Software contributed the strftime formatting code to handle years earlier than 1900 Jochen Voss maintained the PS backend and has contributed several bugfixes. Nadia Dencheva of STScI provided the contouring and contour labeling code Baptiste Carvello provided the key ideas in a patch for proper shared axes support that underlies ganged plots and multiscale plots Sigve Tjoraand Ted Drain and colleagues at the JPL collaborated on the QtAgg backend Eric Firing added the contourf function and general contour refactoring

pie demo