>  Docs Center  >  Libraries  >  Coyote  >  CGPLOT


  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.




    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 `Aspect` cannot be used when plotting with
    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 `Aspect` keyword 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
        If the `Output` keyword 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, default=""
        Set this keyword to the type of output desired. Possible values are these::
            '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
        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.
        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 `Aspect` keyword 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 keyword appropriate for the IDL Plot command 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


        David W. Fanning
        1645 Sheely Drive
        Fort Collins, CO 80526 USA
        Phone: 970-221-0438
        E-mail: david@idlcoyote.com
        Coyote's Guide to IDL Programming: http://www.idlcoyote.com


    Change History::
        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.


    Copyright (c) 2010-2012, Fanning Software Consulting, Inc.

© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us