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, using an archive file from yesterday (Oct 17), when we had a windstorm in Boulder. Here’s the result:
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.

Is that zip file password protected? I can’t seem to open it with two different types of extraction software on my Windows machine.
Opens for me on my Mac.
I finally found a program that can open the zip file, but when I try to extract the files I’m told the *.pro file has a “CRC error”. I have NO idea what that is!
That sounds like a corrupted file.
I like to use the “position=position” keyword, and then I can also use the x and y indices for placing titles and labels. I’ll quickly describe what I do below, in case it’s useful too:
The link below points to my plot_position.pro script, which I use to calculate the “position” vector for an arbitrary ncol by nrow page. You can return the position vector for a given plot “cnt”. It also controls the distance between plots (with the *buffer keywords), so you can gang plots together if you wish. You can also (e.g.) produce a top row plot which spans the full page, with a second row plot with three columns underneath – just use the pageTop keyword on the second call. An example is below (caveat emptor: untested as I’m still waiting for new license key!):
;; Get position for wide plotwinDim = [600,300]
ncol = 1
nrow = 2
leftMargin = 0.1 ;; space for y and x titles
botMargin = leftMargin
buffer = 0.05
cnt = 1
topPlotPosition = plot_position(ncol,nrow,1,leftMargin,botMargin,buffer,$ ;; 1 col, 2 rows
winDim=winDim, /newWin) ;; draw new window on first call
;; Now get position of second row plots, using y0 of topPlotPosition as the top of the page
ncol = 3
nrow = 1
cnt = 1
botPlotPosition1 = plot_position(ncol,nrow,cnt,leftMargin,botMargin,buffer,pageTop=topPlotPosition[1]-buffer)
botPlotPosition2 = plot_position(ncol,nrow,cnt+1,leftMargin,botMargin,buffer,pageTop=topPlotPosition[1]-buffer)
botPlotPosition3 = plot_position(ncol,nrow,cnt+2,leftMargin,botMargin,buffer,pageTop=topPlotPosition[1]-buffer)
!null = plot(fingen(10),findgen(10),position=topPlotposition
(Can obviously do this in a loop to make it neater)
I guess it would be better if everything except ncol, nrow and cnt had defaults – planning to do that once I have time to edit the scripts that call it! …Hope it’s useful for some.
http://sites.google.com/site/pauljyoung/plot_position.pro
Pingback: Positioning plots | The IDL Data Point