
The LAYOUT property specifies a grid within a graphics window, and determines where the graphic should appear. The grid is determined by the number of columns (ncolumns) by the number of rows (nrows). The location of the graphic is determined by the third number. The grid numbering starts in the upper left (1) and goes sequentially by column and then by row. Note: For each graphic after the first one, you must use the CURRENT property to direct IDL to place the graphic in the same window. The following example shows precipitation and temperature data for Denver, Colorado. LAYOUT Example Using the CONTOUR Function With OVERPLOT PRECIP = TEMP = DAY = FINDGEN( 12) * 30 + 15 Plot #1: In position #1 on the grid defined by LAYOUT myPlot = PLOT(DAY, PRECIP, 'ro-',$ TITLE= 'Denver Precipitation', $ YTITLE= 'Inches', XTITLE= 'Day of Year', $ LAYOUT=) Plot #2: In position #4 on the grid defined by LAYOUT myPlotToo = PLOT(DAY, TEMP, 'bS:', $ TITLE= 'Denver Temperature', $ XTITLE= 'Day of Year', $ YTITLE= 'Degrees Fahrenheit', /CURRENT, $ LAYOUT=)īoth plots appear in the same window, as defined by LAYOUT.
#Multiple plots in one graph r how to
The following example shows how to use LAYOUT as a simple grid.
#Multiple plots in one graph r code
The code shown below creates the graphic shown above. You can copy the entire block and paste it into the IDL command line to run it.

Open the Maroon Bells elevation data RESTORE, FILEPATH( 'marbells.dat', SUBDIR=) Display the data as an image in the first cell and define the cell grid as two columns, one row.

myImage = IMAGE(elev, LAYOUT=,$ MARGIN=, $ TITLE= 'Maroon Bells Image') Use CURRENT to display the visualization in the same window, in the next cell. m圜ontour = CONTOUR(elev, N_LEVELS= 10, /OVERPLOT) POSITION myImageToo = IMAGE(elev, /CURRENT, LAYOUT=,$ MARGIN=, $ TITLE= 'Maroon Bells Image with Contours') Display the contour lines as an overplot in the same cell. The POSITION property (common to all the graphics functions) allows you to position one or more graphics within one graphic window. Set this property to either a two-element or four-element vector. For two elements, the POSITION gives the location of the lower-left corner of the graphic, in normalized coordinates.
