X
14055 Rate this article:
No rating

Making a multi-panel plot

Anonym

Multiple-panel plots (or small multiples, from Edward Tufte) group a set of plots for convenient comparison. In DG, multi-panel plots can be built with the !p.multi system variable, or the MULTIPLOT astrolib routine. I'd like to show how to make a multi-panel plot in NG. I coded up an example that creates a set of plots similar to those on the NCAR Foothills Lab weather station page, when we had a windstorm in Boulder. Here's the result:

A six-panel plot of measurements from the NCAR FL weather station.

You can download the example program and its associated data from here. If I could run a lowpass filter over my code, here's the fundamental structure that would emerge:

 p1 = plot(data1, layout=[2,3,1]) p2 = plot(data2, layout=[2,3,2], /current) p3 = plot(data3, layout=[2,3,3], /current) p4 = plot(data4, layout=[2,3,4], /current) p5 = plot(data5, layout=[2,3,5], /current) p6 = plot(data6, layout=[2,3,6], /current)

Six plots, six calls to PLOT. LAYOUT uses a three-element array, [ncolumns, nrows, plot index], where plot index is one-based, to organize a multi-panel plot. The CURRENT keyword is needed on plots after the first so that PLOT knows to place the plot into the current window. For the details (the highpass filter!) of making the plot above, please see my example program.