Book Review: “Gnuplot In Action” by Philipp K. Janert
A while back, I posted here about getting acquainted with “gnuplot”, a handy cross-platform plotting tool. Philipp K. Janert happened by and offered me a review copy of his book on “gnuplot”. I’m busily working up a manuscript for submission. Today, I was working on figures and dealing with “gnuplot” once again, and found occasion to refer to Janert’s text more than once on things that otherwise were a bit mysterious. That is despite the fact that “gnuplot” documentation is featured here and there across the web.
An example? I have some plots where I want to show two datasets at a time in the same plot. Here’s a trivial case where I actually plot the same dataset twice:
This relies on the use of “pm3d” mode in “gnuplot”, something that gets a fair bit of attention in “Gnuplot in Action”.
OK, so where’s a real two-dataset example? Here’s one I was working on, where I simply added the specification for the bottom map as in the trivial example above, but used a different data set for the surface rendering.
Obviously, I have a problem. I actually spent a fair chunk of time Googling to see if I could find someone else addressing this issue, without success. Eventually, I remembered Janert’s book and started looking through it. The solution found there lies with a generic data-handling facility in “gnuplot” and not with something specific to the “pm3d” mode I’m using. What’s happening is that the scale from the second dataset is being used to color-map the first dataset, with unappealing results. Fortunately, I can rescale the first dataset on the fly, as Janert points out in section 3.3, “Data Transformations”. I simply multiplied the value from the first dataset to fit it into the range of the second dataset.
And, of course, mixing a surface mapped dataset with one presented as lines is not a big deal.
My research currently involves making sense of large amounts of data. Part of the attraction to “gnuplot” is its ability to render surface-mapped graphics based on relatively simple instructions. I have various Perl scripts that pre-process the data and emit “gnuplot” scripts, then make a system call to “gnuplot” with the appropriate script. If I were doing all this in Matlab, I’d have to settle for having far fewer graphics produced, since that requires a fair degree of interactivity getting from data to graphic.
There are a lot of techniques and ideas in “Gnuplot in Action” that I haven’t had cause to use yet. So far, it has been a substantial technical aid toward my goal of producing publication-quality graphics. “gnuplot” is a handy, flexible tool for getting from data to visualization, and Philipp Janert’s “Gnuplot in Action” is a good introduction and technical reference to have on hand when using “gnuplot”.