From GDL Wiki
Jump to: navigation, search

The MULTIPLOT routine in the IDL Astronomy User's Library doesn't work in GDL, but here is a workaround.

Set the number of plots, and the [x,y] coordinates for the lower-left and upper-right boundaries of the plot area in device coordinates. Use the lower-left boundaries to leave room for axis titles.

nplots = 3
ll = [0.1,0.1]
ur = [0.975,0.975]

The next two lines are examples for how to set the coordinates of the borders in between plots, for vertically-stacked plots. The bottom of the first plot is located at first and the bottom of the second plot is located at second.

first = (ur[1]-ll[1])/nplots*(nplots-1) + ll[1]
second = (ur[1]-ll[1])/nplots*(nplots-2) + ll[1]

Then use the POSITION keyword to specify the lower-left and upper-right coordinates of each plot, as follows. Use the /NOERASE keyword for making the multiple plots, leaving !P.MULTI = 0. To have GDL still draw axes in between the plots, but not label the tick marks, use XTICKFORMAT="(A1)".

plot,xvalues,yvalues,position=[ll[0],first,ur[0],ur[1]],xtickformat="(A1)",ytitle='Y Title 1'
plot,xvalues,yvalues,position=[ll[0],second,ur[0],first],xtickformat="(A1)",/noerase,ytitle='Y Title 2'
plot,xvalues,yvalues,position=[ll[0],ll[1],ur[0],second],/noerase,xtitle='X Yitle',ytitle='Y Title 3'