Re: [matplotlib-devel] What would you like to see in a book about Matplotlib?
Note: Posted to matplotlib-devel and debian-science.
Firstly, good luck with the book.
The sort of book I'd buy would explain how to use the combination of
matplotlib/ipython/scipy/numpy to analyse data.
> - what are you using matplotlib for?
I want to use matplotlib/ipython/numpy/scipy for analysis of
experimental data - plotting and fitting models to it. Also perhaps
simulation of the data.
I have also wanted to use matplotlib to plot data as it was acquired -
I've not really used matplotlib in anger - but am likely to do so in
the future (and it would have been useful during my PhD had it been
> - what are the things you like the most of matplotlib, that you want
> to give emphasis to? And why?
Quality plots. The ability to add TeX labels.
I've been keeping an eye on matplotlib for several years - it looks
good. I really must spend some time exploring it.
> - what are the (basic) things that, when you were beginning to use
> matplotlib, you wanted to see grouped up but couldn't find?
> - what would you like to see in a book about matplotlib?
Start off by reading data from a file, plotting it and fitting a
function to that data.
Often, several scans are in the same data file. An elegant solution to
reading data something like this example would be useful.
# Scan: 1
# Time: 18:00
# Temperature: 21
# t data
# Scan: 2
# Time: 18:02
# Temperature: 30
# t data
And so on.
Fitting a function to several data sets - with some of the parameters
fitted to both sets of data and some not would be useful.
> - what are some those advanced feature that made you yell "WOW!!" ?
> - what are the things you'd like to explore of matplotlib and never
> had time to do?
Plotting with related scales
Sometimes it is useful to plot related scales on x1 and x2 axes. I've
come across this several times in different contexts. In its simplest
form, there is a linear relationship between the axes. In a mechanical test, you might want extension on the x1 axis and strain on the x2 axis (for example).
Sometimes there is not a linear relationship. For example you might
want to plot frequency (or photon energy) on x1 and wavelength on x2.
An even more complex example is a Hall-Petch plot:
(Yield Stress) = k/sqrt(Grain Size)
So plotting 1/Sqrt(Grain Size) on the X1 axis gives a linear
plot, but it would be useful to plot the grain size on the X2 scale.
ipython and emacs
Suppose I want to write a script to analyse some data (perhaps I want
a record of what I've done, or perhaps I'd like to perform the same
analysis on several data sets). I'd probably do so in emacs - but it
is useful to do some experimentation in ipython - tab completion is
particularly useful. I feel there must be a good way to do my
experimentation in ipython and save the important bits in emacs - but
I've not sat down and worked out an efficient way of doing this.
Data aqcuisition and experimental control:
Writing a simple application to acquire data - ideally from multiple
sources and plot the data as it is acquired. In my case I wanted to
combine mechanical with electrical tests. A couple of interesting
articles by G Varoquaux are listed at
This is perhaps beyond the scope of the book, but it has come up on
the mailing lists a couple of times. The ideal application would have
a gui for simple use, but a command line (probably ipython) for more
more complex use - perhaps performing a series of tests under
Some discussion of plotting non gridded 2d data should also be in
> Your suggestions are really appreciated :) And wish me good luck!
I don't think it is the thrust of your book, but another book I was
looking for is "A cookbook of Numerical simulations of classic
physics/engineering problems". For use by physicists/engineers who
don't want to rewrite things from scratch.