Keyword Inheritance Example using the _EXTRA Keyword Use the _EXTRA keyword to inherit keywords from one plot command to store and set properties for other plots. myPlotTwo = PLOT(cosine, '-b', AXIS_STYLE= 1, $ /CURRENT, POSITION=) _EXTRA Position the plot to display as a subplot in the same space. myPlot = PLOT(sinewave, '-r', AXIS_STYLE= 1, $ POSITION=, $ TITLE= 'Sine with cosine subplot') Define the second plot. Position the plot to cover most of the graphic window. Using the same data as the example above, the following example shows how to position a large plot with a subplot: Define plot data sinewave = SIN( 2.0* FINDGEN( 200)*!PI/ 25.0)* EXP(- 0.02* FINDGEN( 200)) cosine = COS( 2.0* FINDGEN( 200)*!PI/ 25.0)* EXP(- 0.02* FINDGEN( 200)) Define the first visualization using the PLOT function. aPlot = PLOT(cosine, '-b', /OVERPLOT, TITLE= 'Combined plots') POSITION Example Showing a Plot with a Subplot Use OVERPLOT to draw on top of the previous plot. myThirdPlot = PLOT(sinewave, '-r',$ /CURRENT, POSITION=) Draw the cosine plot. myPlotToo = PLOT(cosine, '-b',$ /CURRENT, POSITION=,$ TITLE= 'Cosine') Display the sine and cosine data combined. myPlot = PLOT(sinewave, '-r',$ POSITION=, TITLE= 'Sinewave') Plot the cosine data, defining the plot symbol as a blue dash. sinewave = SIN( 2.0* FINDGEN( 200)*!PI/ 25.0)* EXP(- 0.02* FINDGEN( 200)) cosine = COS( 2.0* FINDGEN( 200)*!PI/ 25.0)* EXP(- 0.02* FINDGEN( 200)) Use the PLOT function, defining the plot line as a red dash using '-r', and use POSITION to define three cells. You can copy the entire block and paste it into the IDL command line to run it. The code shown below creates the graphic shown above. The following example displays how to use POSITION in a freeform layout. POSITION Example Using the OVERPLOT Keyword Note: For each graphic after the first one, you must use the CURRENT property to tell IDL to place the graphic in the same window. For four elements, the POSITION gives the lower left and upper right corners of the graphic, in the form. For two elements, the POSITION gives the location of the lower-left corner of the graphic, in normalized coordinates. Set this property to either a two-element or four-element vector. The POSITION property (common to all the graphics functions) allows you to position one or more graphics within one graphic window. 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. myImage = IMAGE(elev, LAYOUT=,$ MARGIN=, $ TITLE= 'Maroon Bells Image') Use CURRENT to display the visualization in the same window, in the next cell. 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. The following example shows how to use LAYOUT as a simple grid. 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. The following example shows precipitation and temperature data for Denver, Colorado. 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 grid numbering starts in the upper left (1) and goes sequentially by column and then by row. The location of the graphic is determined by the third number. The grid is determined by the number of columns (ncolumns) by the number of rows (nrows). The LAYOUT property specifies a grid within a graphics window, and determines where the graphic should appear.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |