cgPlot, x [, y] [, /ADDCMD] [, ASPECT=float] [, AXISCOLOR=string/integer] [, AXESCOLOR=string/integer] [, BACKGROUND=string/integer] [, CHARSIZE=float] [, COLOR=string/integer] [, FONT=integer] [, /ISOTROPIC] [, LABEL=string] [, LAYOUT=intarr(3)] [, LEGENDS=object] [, /NODATA] [, /NOERASE] [, OPLOTS=object] [, OUTFILENAME=string] [, OUTPUT=string] [, /OVERPLOT] [, POSITION=vector] [, PSYM=integer] [, SYMCOLOR=string/integer] [, SYMSIZE=float] [, TITLE=string] [, /TRADITIONAL] [, /WINDOW] [, XTITLE=string] [, YTITLE=string] [, _REF_EXTRA=any]
The purpose of cgPlot is to create a wrapper for the traditional IDL graphics command, Plot. The primary purpose of this is to create plot commands that work and look identically both on the display and in PostScript files.
Program default colors will depend on the IDL graphics window. If no windows are currently open when the program is called, cgDisplay is used to create a window.
The program requires the Coyote Library to be installed on your machine.
- x in required type=any
If X is provided without Y, a vector representing the dependent values to be plotted If both X and Y are provided, X is the independent parameter and Y is the dependent parameter to be plotted.
- y in optional type=any
A vector representing the dependent values to be plotted.
- ADDCMD in optional type=boolean default=0
Set this keyword to add the command to the resizeable graphics window cgWindow.
- ASPECT in optional type=float default=none
Set this keyword to a floating point ratio that represents the aspect ratio (ysize/xsize) of the resulting plot. The plot position may change as a result of setting this keyword. Note that
Aspectcannot be used when plotting with !P.MULTI.
- AXISCOLOR in optional type=string/integer default=opposite
If this keyword is a string, the name of the axis color. Otherwise, the keyword is assumed to be a color index into the current color table.
- AXESCOLOR in optional type=string/integer
Provisions for bad spellers.
- BACKGROUND in optional type=string/integer default=background
If this keyword is a string, the name of the background color. Otherwise, the keyword is assumed to be a color index into the current color table.
- CHARSIZE in optional type=float default=cgDefCharSize()
The character size for axes annotations. Uses cgDefCharSize to select default character size, unless !P.Charsize is set, in which case !P.Charsize is always used.
- COLOR in optional type=string/integer default=black
If this keyword is a string, the name of the data color. By default, 'black'. Color names are those used with cgColor. Otherwise, the keyword is assumed to be a color index into the current color table.
- FONT in optional type=integer default=!P.Font
The type of font desired for axis annotation.
- ISOTROPIC in optional type=boolean default=0
A short-hand way of setting the
Aspectkeyword to 1.
- LABEL in optional type=string
A label is similar to a plot title, but it is aligned to the left edge of the plot and is written in hardware fonts. Use of the label keyword will suppress the plot title.
- LAYOUT in optional type=intarr(3)
This keyword specifies a grid with a graphics window and determines where the graphic should appear. The syntax of LAYOUT is three numbers: [ncolumns, nrows, location]. 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 sequentually by column and then by row.
- LEGENDS in optional type=object
One or more cgLegendItem objects that are to be drawn on the plot.
- NODATA in optional type=boolean default=0
Set this keyword to draw axes, but no data.
- NOERASE in optional type=boolean default=0
Set this keyword to draw the plot without erasing the display first.
- OPLOTS in optional type=object
A single cgOverPlot object, or an array of cgOverPlot objects that will be overplot on the axes set up by the original data. The user will be responsible for destroying the objects. The cgPlot program will simply draw the objects.
- OUTFILENAME in optional type=string
Outputkeyword is set, the user will be asked to supply an output filename, unless this keyword is set to a non-null string. In that case, the value of this keyword will be used as the filename and there will be no dialog presented to the user.
- OUTPUT in optional type=string
Set this keyword to the type of output desired. Possible values are these:Or, you can simply set this keyword to the name of the output file, and the type of file desired will be determined by the file extension. If you use this option, the user will not be prompted to supply the name of the output file.
'PS' - PostScript file 'EPS' - Encapsulated PostScript file 'PDF' - PDF file 'BMP' - BMP raster file 'GIF' - GIF raster file 'JPEG' - JPEG raster file 'PNG' - PNG raster file 'TIFF' - TIFF raster file
All raster file output is created through PostScript intermediate files (the PostScript files will be deleted), so ImageMagick and Ghostview MUST be installed to produce anything other than PostScript output. (See cgPS2PDF and PS_END for details.) And also note that you should NOT use this keyword when doing multiple plots. The keyword is to be used as a convenient way to get PostScript or raster output for a single graphics command. Output parameters can be set with cgWindow_SetDefs.
- OVERPLOT in optional type=boolean default=0
Set this keyword if you wish to overplot data on an already exisiting set of axes. It is like calling the IDL OPLOT command.
- POSITION in optional type=vector
The usual four-element position vector for the Plot comamnd. Only monitored and possibly set if the
Aspectkeyword is used.
- PSYM in optional type=integer
Any normal IDL PSYM values, plus any value supported by the Coyote Library routine cgSYMCAT. An integer between 0 and 46. This may also be set to the "name" of a symbol, such as returned from Print, cgSymCat(/Names).
- SYMCOLOR in optional type=string/integer default=black
If this keyword is a string, the name of the symbol color. By default, 'black'. Otherwise, the keyword is assumed to be a color index into the current color table.
- SYMSIZE in optional type=float default=1.0
The symbol size.
- TITLE in optional type=string
The title of the plot.
- TRADITIONAL in optional type=boolean default=0
If this keyword is set, the traditional color scheme of a black background for graphics windows on the display is used and PostScript files always use a white background.
- WINDOW in optional type=boolean default=0
Set this keyword to replace all the commands in a current cgWindow or to create a new cgWindow for displaying this command.
- XTITLE in optional type=string
The X title of the plot.
- YTITLE in optional type=string
The Y title of the plot.
- _REF_EXTRA in optional type=any
Any IDL Plot keyword not defined here is allowed in the program.
Use as you would use the IDL PLOT command:
cgPlot, Findgen(11) cgPlot, Findgen(11), Aspect=1.0 cgPlot, Findgen(11), Color='olive', AxisColor='red', Thick=2 cgPlot, Findgen(11), Color='blue', SymColor='red', PSym=-16
FANNING SOFTWARE CONSULTING:
David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: email@example.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com
Copyright (c) 2010-2013, Fanning Software Consulting, Inc.
Written, 12 November 2010. DWF. Added SYMCOLOR keyword, and allow all 46 symbols from cgSYMCAT. 15 November 2010. DWF. Added NODATA keyword. 15 November 2010. DWF. Now setting decomposition state by calling SetDecomposedState. 16 November 2010. DWF. Final color table restoration skipped in Z-graphics buffer. 17 November 2010. DWF. Fixed a problem with overplotting with symbols. 17 November 2010. DWF. Background keyword now applies in PostScript file as well. 17 November 2010. DWF. Many changes after BACKGROUND changes to get !P.MULTI working again! 18 November 2010. DWF. Fixed a small problem with the OVERPLOT keyword. 18 Nov 2010. DWF. Changes so that color inputs don't change type. 23 Nov 2010. DWF. Added WINDOW keyword to allow graphic to be displayed in a resizable graphics window. 8 Dec 2010. DWF Modifications to allow cgPlot to be drop-in replacement for old PLOT commands in indexed color mode. 24 Dec 2010. DWF. Previous changes introduced problems with OVERPLOT that have now been fixed. 28 Dec 2010. DWF. Set NOERASE keyword from !P.NoErase system variable when appropriate. 28 Dec 2010. DWF. Additional problems with NOERASE discovered and solved. 29 Dec 2010. DWF. In some cases, I was turning BYTE values to strings without converting to INTEGERS first. 30 Dec 2010. DWF. Selecting character size now with cgDefCharSize. 11 Jan 2011. DWF. Moved setting to decomposed color before color selection process to avoid PostScript background problems when passed 24-bit color integers. 12 Jan 2011. DWF. Changed _EXTRA to _REF_EXTRA on procedure definition statement to be able to return plot keywords such as XGET_TICKS. 13 Jan 2011. DWF. Added SYMSIZE keyword. 16 Jan 2011. DWF. Fixed a problem in which I assumed the background color was a string. 18 Jan 2011. DWF. Added ADDCMD keyword. 26 Jan 2011. DWF. Added LAYOUT keyword. 28 Jan 2011. DWF. Made a modification that allows THICK and COLOR keywords apply to symbols, too. 24 Feb 2011. DWF. Modified error handler to restore the entry decomposition state if there is an error. 17 March 2011. DWF Somehow I had gotten independent and dependent data reversed in the code. Put right. 16 May 2011. DWF. Allowed ASPECT (and /ISOTROPIC) to take into account input POSITION. 15 June 2011. Jeremy Bailin. Updated the BACKGROUND color selection from lessons learned in 27 Oct 2011 cgContour corrections. 27 Oct 2011. DWF. Added the ability to send the output directly to a file via the OUTPUT keyword. 9 Dec 2011, DWF. PostScript, PDF, and Imagemagick parameters can now be tailored with cgWindow_SetDefs. 14 Dec 2011. DWF. Modified to use cgDefaultColor for default color selection. 24 Dec 2011. DWF. Over-zealous use of _STRICT_EXTRA when overplotting resulted in errors. Now use _EXTRA. 1 Jan 2012. DWF. Changes to allow better default colors, based on changes to cgColor and cgDefaultColor. 1 Feb 2012. DWF. Now allowing the user to draw in the "background" color, if the COLOR or AXISCOLOR is "BACKGROUND". 19 March 2012. DWF. Scalar input parameters are changed to 1-element vectors to avoid annoying error messages from PLOT. 6 April 2012. DWF. Added a LABEL keyword. 12 July 2012. DWF. Yikes! Bad choice of variable names in LABEL work yesterday has severe consequences. Changed names. 13 July 2012. DWF. Added OPLOTS keyword to allow cgOverplot objects. 18 July 2012. DWF. Added the ability to specify a symbol name with the PSYM keyword. 19 Juyl 2012. DWF. Added the ability to use escape characters in plot titles to specify cgSymbol symbols. 27 July 2012. DWF. Fixed an interaction with the LABEL keyword that prevented a Title from appearing. 2 Oct 2012. DWF. Modified the way default colors are selected when the background color is "white". 4 Dec 2012. DWF. Still trying to accommodate users who incorrectly specify LONG integers while using INDEXED color. 26 Dec 2012. DWF. Modified code that checks to see if COLOR and AXISCOLOR keywords are the same as BACKGROUND and changes them. This precludes drawing in background color on non-white backgrounds. Now only change the colors if it is possible to draw a background color. 12 Feb 2013. DWF. Problem using symbol names (e.g., 'opencircle') in cgWindows is fixed. 10 May 2013. DWF.
|Modification date:||Fri May 10 13:18:03 2013|