Plotters Part IV

Too depressed about the pending university cuts to write about that yet. Instead lets have fun ! Yes, lets do the fourth and the final part of the rambling Norse Epic that is my series of posts on plotting software.

Just to bring you back up to speed… First there was a general intro. Next up, Part II was about mathematical environments, plot libraries, and equation graphers. This brought out the R fanboys. Part III was about GUI based plotters, wherein I gave healthy plugs to mjograph and the bizarrely named but handy Veusz. In today’s installment I will look at script based plotters.

Sometimes a GUI based application just doesn’t have enough flexibility, and all that clicking is too laborious. On the other hand, pernickety calls to low level routines inside a C programme is just overkill, especially if you already have the data file from somewhere else. A nice little script language is what you want, with sensible defaults, so you can just say plot sin(x)/x and leave it that, or you can gradually add sophistication, setting the axes, line weights, etc, saving the script and fiddling more later.

MONGO and her seed. For astronomers at least, the Mother Of All Plotters is Mongo, written by John Tonry in the 1980s. (Yes, that is the same John Tonry who made the vast camera for PanSTARRS ). It was written in F77, and routines can be called from Fortran programmes as well as run interactively. I think the last version was in 1994, and I don’t think you can get it now, but you can still get the documentation here.

The equally legendary Robert Lupton and Patricia Monger re-implemented Mongo from scratch with added bells and whistles as “Supermongo” or SM. It is available here, and there is a kind of forum-cum-fansite here. It costs $300 for a single Department-wide license but is “not available for military use”.  Back in the Yookay, the Starlink project also re-imagined MONGO. (Can’t stop thinking of Pierre Menard.)  This was called PONGO as the backend was the PGPLOT library. The Starlink project is no more, but the whole suite is maintained and still available via the Joint Astronomy Centre in Hawaii. You have to download the entire rather vast Starlink installation, but you will also get other useful things like Gaia, SPLAT, and ORAC-DR.

There have been other front ends for PGPLOT. Two I am aware of are WIP , written for the  Owens Valley BIMA array project, and  QDP, meaning “Quick and Dandy Plotter”, written by Allyn Tennant at Marshall Space Flight Centre. Finally there is Pyx. This is an implementation of PGPLOT in Python, which can then be strung together in a Python script, but it doesn’t have the simple syntax of SM or Gnuplot. Pyx begat Pyxplot, as we will see below, but in a manner that never occurs in nature, it replaced the genome while keeping the same phenome. Ain’t software fun.

Trusty Gnuplot. Outside the astronomy world, what most people know is  Gnuplot, started in 1986 by Thomas Williams and Colin Kelley, and continously developed and improved since by an army of volunteers. It has a slightly quirky syntax, but is easy to get used to. In interactive mode it has sensible defaults, so you can just fire up and plot a function or a data file with very little fuss, but it is also very powerful and flexible – for example you can plot arbitrary algebraic combinations of columns, plot parametric functions, and fit datasets. You can define constants and functions, and you can keep your own library of these which you load at startup. For example, I have a standard blackbody function, and then in a new script I can just refer to RBB(nu,T). This also means that in interactive mode you can use Gnuplot as a calculator, and some days I prefer this to Python. It does pretty much everything you need with some minor niggles – for example in SM you can use a column to record a different point type for each data point, whereas in Gnuplot you would have to achieve this by dividing into blocks and using several plot commands.  Although the point of Gnuplot is scripting, just to confuse you, you can get a GUI front end to Gnuplot – here is a Mac example. This isn’t quite as daft as it sounds – its a handy way of reminding yourself of options, and can be quicker than looking things up in the manual.

Gri. An alternative to Gnuplot is  Gri, written by Dan Kelley and Peter Galbraith. Its syntax is slightly friendlier than Gnuplot. I have only done a quick test drive, but it looks like its not quite as flexible and powerful as Gnuplot. For example, it doesn’t do parametric plots or curve fitting, and plotting functions is rather more awkward.  It does maths RPN style, so John Peacock should love it, but for most folk thats an annoyance. I found it harder to get really nice looking output than with Gnuplot. So I probably won’t swap to Gri. But if there are fans out there, do tell me I’m wrong !

Pyxplot. So now we come to this week’s main plug,  Pyxplot . This was written by Dominic Ford, with help from others. Dominic is a PDRA at the Cavendish in Cambridge, whereas Jeremy Sanders who gave us Veusz is at IOA, so I expect there’s no rivalry there then … Methinks there should be another plotting package by the People’s Front of Judaea. Err.. anyway, where was I ?

Pyxplot is a kind of re-invention of Gnuplot (there goes Pierre Menard again), with almost identical commands and syntax. Originally, it was written in Python, using the Pyx library, but the latest version has been completely re-written in C++, for speed and reliability reasons. If you use Gnuplot, you can get straight down and use Pyxplot, and re-use your scripts with minimal changes. However, Dominic has taken the opportunity to add some rather groovy stuff, mostly in its mathematical environment. Some of the extra things Pyxplot can do :

  • annotate in TeX
  • convert physical units
  • do calculations with complex numbers
  • evaluate integrals
  • find minima and maxima
  • solve simultaneous equations
  • use pre-supplied list of physical constants – hbar etc
  • read FITS tables
  • load data from a URL
  • output a sampled function as a datafile
  • Fourier transform data files
  • output a histogram from a column of data
  • generate random numbers
  • use programming logic, like for loops, conditionals, and subroutines
  • plot 2D data as a surface or as a colour map

Plotting parametric functions is easier than in Gnuplot. I think the control of plots and styles and so forth is even more thorough than Gnuplot, but I can’t say I have crosschecked everything.  One possible drawback is that it still has some performance issues – some of my Gnuplot scripts run distinctly slower than in Gnuplot. But overall it is pretty amazing and I do recommend giving it a go.

Here ends the Saga. Unless I add another chapter where Robert Lupton goes baresark in Princeton and Jeremy leads a raiding party to the Cavendish and steals Dominic’s women.

Advertisements

6 Responses to Plotters Part IV

  1. jz says:

    “Pyxplot. So now we come to this week’s main plug, Pyxplot . This was written by Dominic Ford, with help from others. Dominic is a PDRA at the Cavendish in Cambridge, whereas Jeremy Sanders who gave us Veusz is at IOA, so I expect there’s no rivalry there then … Methinks there should be another plotting package by the People’s Front of Judaea. Err.. anyway, where was I ?”

    Priceless.

    Of course, like once unthought-of peace in Northern Ireland, there is now the Kavli.

  2. […] of people just read my post on plotter script packages, but there has only been one comment. I conclude that even software fans are too busy fretting over […]

  3. jz says:

    Now is not a time for plotting

  4. jim says:

    ¿why nat?

  5. Actually, recent versions of gnuplot can also use a data-file column to specify a different point type/size/color/etc for each data point.

  6. andyxl says:

    Oooo. Must check it out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: