Anatomy of Matplotlib
Benjamin Root -
Ben Root is a member of the matplotlib development team. Main areas of development are the documentation and the mplot3d toolkit. Ben is also an active member of the mailing lists and has been using that experience in helping newcomers understand matplotlib to improve the documentation. Ben is a Meteorology graduate student who has nearly completed his PhD and has recently started working for a research company which has adopted Python as the preferred programming language. Part of his responsibilities in his new job is to help transition co-workers over to the Python toolset.
This tutorial will be the introduction to matplotlib, intended for users who want to become familiar with python's predominate scientific plotting package. First, the plotting functions that are available will be introduced so users will know what kinds of graphs can be done. We will then cover the fundamental concepts and terminologies, starting from the figure object down to the artists. In an organized and logical fashion, the components of a matplotlib figure are introduced, such as the axes, axis, tickers, and labels. We will explain what an Artist is for, as well as explain the purpose behind Collections. Finally, we will take an overview of the major toolkits available to use, particularly AxesGrid, mplot3d and basemap.
- Purpose of matplotlib
- Online Documentation
- Examples Page
- Gallery Page
- API documentation
- Mailing Lists
- Github Repository
- Bug Reports & Feature Requests
What is this "backend" thing I keep hearing about?
- Graphs (plot, scatter, bar, stem, etc.)
- Images (imshow, pcolor, pcolormesh, contour[f], etc.)
- Lesser Knowns: (pie, acorr, hexbin, etc.)
- Brand New: streamplot()
What goes in a Figure?
- ticks (and ticklines and ticklabels) (both major & minor)
- axis labels
- axes title
- figure suptitle
- axis spines
- colorbars (and the oddities thereof)
- axis scale
- axis gridlines
(Throughout the aforementioned section, I will be guiding audience members through the creation and manipulation of each of these components to produce a fully customized graph)
- Hands-On: Have users try making some changes to the settings and see how a resulting figure changes
What is an Artist?
- Hands-On: Have audience members create some and see if they can get them displayed
What is a Collection?
- Hands-On: Have audience members create some, manipulate the properties and display them
- color (and edgecolor, linecolor, facecolor, etc...)
- linewidth and edgewidth and markeredgewidth (and the oddity that happens in errorbar())
What are toolkits?
Matplotlib (version 1.2.1 or later is preferred, but earlier version should still be sufficient for most of the tutorial)