# coyote: CGPLOTS

- coyote/Graphics
- [Source code]

Description

      The purpose of cgPlotS is to create a wrapper for the traditional IDL graphics
      command, PlotS. The primary purpose of this is to create plot commands that work
      and look identically both on the display and in PostScript files.
      The program requires the `Coyote Library <http://www.idlcoyote.com/documents/programs.php>`
      to be installed on your machine.

Categories

      Graphics

Params

      X_: in, required, type=any
           A vector or scalar argument providing the X components of the points to be
           drawn or connected. May be a 2xN or 3xN array, if Y and Z parameters are
           not used.
      Y_: in, optional, type=any
           A vector or scalar argument providing the Y components of the points to be
           drawn or connected.
      Z_: in, optional, type=any
           A vector or scalar argument providing the Z components of the points to be
           drawn or connected.

Keywords

      addcmd: in, optional, type=boolean, default=0
         Set this keyword to add the command to an cgWindow display.
      color: in, optional, type=string/integer, default='opposite'
         If this keyword is a string, the name of the data color.
         Color names are those used with cgColor. Otherwise, the keyword is assumed
         to be a color index into the current color table. May be a vector of the same
         length as X.
      map_object: in, optional, type=object
         If you are drawing on a map projection set up with Map_Proj_Init
         and using projected meter space, rather than lat/lon space, then you can use this
         keyword to provide a cgMap object that will allow you to convert the `x` and `y`
         parameters from longitude and latitude, respectively, to projected meter space
         before drawing. X and Y must both be present.
      psym: in, optional
         Any symbol value supported by the Coyote Library routine cgSYMCAT. In particular, an
         integer or integer array the same length as X with values between 0 and 46. The keyword
         may also be specified as a symbol name or names. If using symbol names, the symbol cannot
         be set to a negative value. See `cgSymCat` for details.
      symcolor: in, optional, type=string/integer/vector, default=COLOR
         If this keyword is a string, the name of the symbol color. By default, same as COLOR.
         Otherwise, the keyword is assumed to be a color index into the current color table.
         May be a vector of the same length as X.
      symsize: in, optional, type=float/vector, default=1.0
         A scalar or vector of symbol sizes. Default is 1.0. May be a vector of the same
         length as X.
      window: in, optional, type=boolean, default=0
          Set this keyword to add the command to the current cgWindow application.
      _extra: in, optional, type=any
         Any `IDL PlotS keyword <http://www.exelisvis.com/docs/PLOTS_Procedure.html>`
         not defined here is allowed in the program.

Examples

      Use like the IDL PLOTS command::
          cgPlot, Findgen(11)
          cgPlotS, !X.CRange, [5,5], LINESTYLE=2, THICK=2, COLOR='red'
      Use vectors for symbols and colors::
          seed = -3L
          x = Randomu(seed, 5) * 9 + 0.5
          x = x[Sort(x)]
          y = Randomu(seed, 5) * 9 + 0.5
          cgPlot, x, y, /NoData
          colors = ['red6', 'blu6', 'grn6', 'dodger blue', 'orange']
          symbols = Indgen(5)+14
          cgPlots, x, y, PSYM=symbols, Color=colors, SymSize=2

Author

      FANNING SOFTWARE CONSULTING::
          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

History

      Change History::
         Written, 12 November 2010. DWF.
         Added SYMCOLOR keyword. PSYM accepts all values from cgSYMCAT. SYMCOLOR and SYMSIZE
            keywords can be vectors the size of x. 15 November 2010. DWF
         Added ability to support COLOR keyword as a vector the size of x. 15 November 2010. DWF
         Now setting decomposition state by calling cgSetColorState. 16 November 2010. DWF.
         Final color table restoration skipped in Z-graphics buffer. 17 November 2010. DWF.
         Changes so that color variables don't change type. 23 Nov 2010. DWF.
         Modified to use decomposed color, if possible. 24 Dec 2010. DWF.
         Whoops! Programming is like herding cats! 29 Dec 2010. DWF.
         In some cases, I was turning BYTE values to strings without converting to
             INTEGERS first. 30 Dec 2010. 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.
         Added WINDOW keyword. 24 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
         Fixed a problem in which the colors of the line was not accurate in some cases. 29 November 2011. DWF.
         Added the MAP_OBJECT keyword for plotting on map projections. 2 Jan 2012. DWF.
         Made sure the map coordinate system is established before drawing if a map object is passed
              into the program. 26 June 2012. DWF.
         Added the ability to specify the PSYM keyword as a string. 20 July 2012. DWF.
         Added a check for a window to draw into, if needed. 8 July 2012. DWF.
         Loop counter didn't assume someone would pass in 2D array of XY pairs. Fixed. 31 Jan 2013. DWF.
         Added the ability to pass a vector of values via the PSYM keyword. 10 Oct 2014. DWF
         Changes on 10 Oct 2014 caused some problems with cgMap_Grid, which calls cgPlots with arguments
              that are not the same length. Added code to make sure all positional parameters are the same
              length. 16 Oct 2014. DWF.
         Running into more problems from 10 Oct 2014 changes. Have to unpack 2D and 3D data passed in as single parameter.

Copyright

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