Plotters Part II

Yesterday I started some ramblings about plotters. I am sorry to disappoint Alex who was looking foward to hearing about devious schemers. Instead, we have some brief thoughts about mathematical environments, plot libraries, and equation graphers. Tomorrow(ish) will be GUI apps.

Mathematical Environments. Many folk swear by gargantuan packages that provide a programming environment, algorithm libraries, graphics utilities, algebraic manipulation, and so on. Popular packages include IDL, Matlab, Maple and Mathematica . These are very powerful, but with a bit of a learning curve, and of course they all cost lots of dosh. The only free, open source, alternative I am aware of that tries to be a complete Matlab-like replacement is Sage. I haven’t tried this out myself, and would be interested to hear of experiences. The other thing worth mentioning is R which started life as a statistics package and seems to have ballooned into an all-singing all-dancing kind of thing. It has some fans, who have emerged in my recent comment stream, but I haven’t tried it yet. Well, I started trying to read some documentation and nearly lost the will to live.

Plot Libraries. For astronomers at least, the grandaddy is PGPlot, started in 1983 by Tim Pearson and still in everyday use by lots of people. The latest version is 5.2.2 from 2001. It is a library of primitive routines, callable in Fortran or C. Several people have written interactive front ends – WIP, PONGO, and QDP (see Part IV).  PLplot is intended as an updated version of PGPLOT. It has bindings to a very wide range languages, including C, Fortran, Python, Perl, Java, C++, and several others. If Java is your thing, you might also want to look at JFreeChart. If Python is your thing you might want Pyx. It has high level things as well as primitives, and because Python has an interactive mode, you can use it in somewhat the manner you might use Gnuplot. However, as you can see from this example it is distinctly less streamlined and friendly than Gnuplot. Matplotlib is another Python library with both primitives and high level stuff, and ambitions to be a complete environment, a la Matlab. It looks good, but I couldn’t make it work…  There are links to lots more Pythonesque bits and pieces here. So if you want to include plotting in your own programs, there is a lot of choice, but it looks to me like the standard choice these days is PLplot .

Equation Graphers. If all you want is a quick plot of a mathematical function, you can do with this with Gnuplot and cousins, but you are likely to want to explore it – pan and zoom, read out values. In this case an interactive GUI style application makes sense. On the Mac you have this pre-loaded with Grapher, which started life as Graphing Calculator, still independently available here for Mac and Windows. If you want an entertaining hour, you can listen to Ron Avitzur telling the strange story of this application. (There is also a written version of this story.) For Linux folk, there is the wonderfully easy Lybniz – why isn’t there a Macports version ? Another nice lightweight free MacApp is Edengraph but it can’t do some things that Grapher can – like 3D functions, vector fields, independent axis adjustment. Two fairly glitzy commercial applications are A&G Equation Grapher, its cousin Graphing Calculator 3D and Golden Software Grapher. Graphing Calculator 3D has a free version.

Enough for now. Part III will be about GUI-style plotting applications.

Advertisements

18 Responses to Plotters Part II

    • Jane says:

      Excel does nice plots – very intuitive to use. Have done several astro papers with all the plots in Excel and nobody has complained yet… 🙂

      • Aaron Robotham says:

        Hmm, which Jane would this be… I have an idea.

      • andyxl says:

        Jane, I find this comment mysterious. I love many Microsoft applications, and Excel is not bad at doing spreadsheets, but for making charts it used to drive me absolutely barmy.. but we can have that discussion again when I finish the plotter GUIs bit.

      • Michael Merrifield says:

        Clearly, you don’t include enough pie charts in your publications, Andy!

  1. Matt says:

    Sage is more of an all-encompassing software stack for computational math — not just a Matlab replacement. The list of software packages it interoperates with is staggering: Maple, Matlab, Magma, Mathematica, and on and on. But it also implements a completely free computational mathematics engine of its own, and to boot it provides a completely isolated, dependency-free software stack in every download! For a pure matlab replacement, you might be more interested in something like Spyder, which is much closer to what people think of when they think of Matlab. (It’s also part of Python(x,y), which is somewhat like the Enthought Python Distribution.)

    • MatthewH says:

      I’m not sure what most people think of when they think of matlab, but for me Spyder doesn’t even come close, matlab being much closer to your description of Sage. For what we use matlab for, even Sage is somewhat lacking, as it is so concentrated on the mathematics side of the matlab et al. functionality. One of the other open source alternatives scilab, with its scios add-on, is closer to what we need, but last time I checked (a year or so ago) it was still missing some of the functionality that we make use of.

      We’d love to be able to move away from matlab, as its too expensive to be able to provide it for all the members of our group that could usefully use it, but so far there isn’t a good enough replacement for us.

      • MattP says:

        Just to join in the theme of comments from people called Matthew – for a free open source matlab replacement I find octave is generally good enough for most purposes – it’s compatible with the majority (or at least a large number) of matlab functions, and will run most scripts/functions that you may have already written in matlab. Plotting-wise it’s not quite so snazzy as it just uses gnuplot, but for computation it’s fine.

      • Matt says:

        I was mostly speaking of the user interface. Spyder attempts to replicate the multi-pane user interface of Matlab. Sage attempts, mostly, to replicate a notebook UI similar to Mathematica or Maple.

  2. Michael Merrifield says:

    What about SM? A complete environment for manipulating data with a proper command-line interface, crispy-looking plots, and a kinky icon. What more could you ask for in a plot package?

    • andyxl says:

      Thats in Part IV, coming up soon. Its a package for scripting plotting, not a complete mathematical environment. Unless I have missed something…

      • Michael Merrifield says:

        Well, my first postdoc, Rob Olling, used to do all his analysis in SM — the scripting language allows, loops, conditional brancing, etc, so it really is a complete environment. Not sure it would be my choice for that though.

  3. ian smail says:

    do any of these packages have a heaviside function built in?

    its just that based on the rumors i’ve heard about the discussion at the astronomy forum last week, in future many of us will only need a plotting package to attractively display to the UK taxpayer the decline in UK astronomy in an easy to appreciate manner.

    • Michael Merrifield says:

      Sadly, I suspect that the taxpayer’s concern at such a development would be the differential of your function, and a delta function with a rather small integral at that. At least, I am sure that is what the politicians would be relying on if they did pursue such a nuclear option.

      • Cecilia says:

        Excuse a simple engineer in Sweden (whose only “astronomical experience” has been a small statistics project at the astronomy building) for interrupting,

        but I really hope the taxpayers and politicians over in the UK will listen and at least cause a smaller step height in that upside down heaviside function,
        if you guys can loudly communicate the most graspable output consequences to them:
        Telescopes shutting down, less opportunities for school kids (their kids) and the public to be able to watch stars and comets, fewer professionally guided tours at telescopes, etc.

        kind regards
        /C

  4. […] I was a general intro. Part II was about mathematical environments, plot libraries, and equation graphers. Now I will launch into […]

  5. Simon says:

    I take the point about R documentation.

    IMHO there are two reasons for this. (i) A lot is written for regular R users (so assumes you already know how R works). (ii) Almost all is written from a classical stats background, therefore uses stats lingo that might be familiar to quantitative life and social scientists, but not intuitively obvious to us physicists/astronomers. We have our own [inconsistent] lingo and tend to tackle slightly different problems (e.g. “fitting” vs. “regression”, etc.).

    If anyone is keen to try R I would recommend spending a couple of hours working through “An Introduction to R” at http://cran.r-project.org/ [Manuals page].

    If you like what you see then try one of the of free documents available that introduce R. Find one you like the look of here:

    http://cran.r-project.org/other-docs.html

    There’s even now a whole series of books on using R – called “UseR!” I started using MCMC methods seriously after reading “Bayesian computation using R” from this series.

    End of plug.

  6. Cosmetic foundation…

    […]Plotters Part II « The e-Astronomer[…]…

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: