PLOT


List of Routines


Routine Descriptions

CLEANPLOT

[Next Routine] [List of Routines]
 NAME:
	CLEANPLOT
 PURPOSE:
	Reset all system variables (!P,!X,!Y,!Z) set by the user which 
	affect plotting to their default values.

 CALLING SEQUENCE:
	Cleanplot

 INPUTS:	
	None

 OUTPUTS:	
	None

 SIDE EFFECTS:	
	The system variables that concern plotting are reset
	to their default values.  A message is output for each
	variable changed.   The CRANGE, S, WINDOW, and REGION fields of the
	!X, !Y, and !Z system variables are not checked since these are 
	set by the graphics device and not by the user.    

 PROCEDURE:
	This does NOT reset the plotting device.
	This does not change any system variables that don't control plotting.

 RESTRICTIONS:
	If user default values for !P, !X, !Y and !Z are different from
	the defaults adopted below, user should change P_old etc accordingly

 MODIFICATION HISTORY:
	Written IDL Version 2.3.0  W. Landsman & K. Venkatakrishna May '92
	Handle new system variables in V3.0.0     W. Landsman   Dec 92

(See /usr/local/idl/lib/zastron/plot/cleanplot.pro)


CURFULL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	CURFULL

 PURPOSE:
	This program is designed to essentially mimic the IDL CURSOR command,
	but using a full screen cursor rather than a small cross cursor.
	Uses OPLOT and X-windows graphics masking to emulate the cursor.

 CALLING SEQUENCE:
	curfull, [X, Y, WaitFlag], [/DATA, /DEVICE, /NORMAL, /NOWAIT, /WAIT,
		/DOWN, /CHANGE, LINESTYLE=, THICK=, /NOCLIP]

 REQUIRED INPUTS:
	None.

 OPTIONAL INPUTS: 
	WAITFLAG = if equal to zero it sets the NOWAIT keyword {see below} 

 OPTIONAL KEYWORD PARAMETERS:
	DATA = Data coordinates are returned.
	DEVICE = device coordinates are returned.
	NORMAL = normal coordinates are returned.
	NOWAIT = if non-zero the routine will immediately return the cursor's
		present position.
       WAIT = if non-zero will wait for a mouse key click before returning.
       DOWN = equivalent to WAIT
       CHANGE = returns when the mouse is moved OR if a key is clicked.
       LINESTYLE = style of line that makes the cursor.
       THICK = thickness of the line that makes the cursor.
       NOCLIP = if non-zero will make a full-screen cursor, otherwise it will
		default to the value in !P.NOCLIP.

 NOTES:
	Note that this procedure does not allow the "UP" keyword/flag...which 
	doesn't seem to work too well in the origianl CURSOR version anyway.

       If a data coordinate system has not been established, then CURFULL
 	will create one identical to the device coordinate system.   Note
	that this kluge is required even if the user specified /NORMAL
	coordinates, since CURFULL makes use of the OPLOT procedure

	Only tested on X-windows systems.    If this program is interrupted,
	the graphics function might be left in a non-standard state.   Type
	DEVICE,SET_GRAPHICS=3 to return the standard graphics function.

 PROCEDURE:
	The default cursor is blanked out and full-screen (or full plot window, 
 	depending on the value of NOCLIP) intersecting lines are drawn centerd
	on the cursor's position. 

 MODIFICATION HISTORY:
	Written by J. Parker  22 Nov 93
	Create data coordinates if not already present, W. Landsman Nov. 93

(See /usr/local/idl/lib/zastron/plot/curfull.pro)


LEGEND

[Previous Routine] [Next Routine] [List of Routines]
 Name:
      	LEGEND 
 Purpose:
	This procedure makes a legend for a plot.  The legend can contain
	a mixture of symbols, linestyles, Hershey characters (vectorfont),
	and filled polygons (usersym).
 Examples:
	The call:
		legend,['diamond','asterisk','square'],psym=[4,2,6]
	produces:
		-----------------
		|		|
		|  <> diamond	|
		|  *  asterisk	|
		|  [] square	|
		|		|
		-----------------
	Each symbol is drawn with a plots command, so they look OK.
	Other examples are given in usage.
 Usage:
	legend,items,linestyle=linestyle	; vertical legend at upper left
	legend,items,psym=psym			; ditto except using symbols
	legend,items,psym=psym,/horizontal	; horizontal format
	legend,items,psym=psym,box=0		; sans border
	legend,items,psym=psym,delimiter='='	; embed an '=' betw psym & text
	legend,items,psym=psym,margin=2		; 2-character margin
	legend,items,psym=psym,position=pos	; position of legend
	legend,items,psym=psym,number=2		; plot two symbols, not one
	legend,items,/fill,psym=[8,8,8],colors=[10,20,30]; 3 filled squares
 Inputs:
	items = text for the items in the legend, a string array.
		You can omit items if you don't want any text labels.
		For example, items = ['diamond','asterisk','square'].
 Optional Inputs:
	linestyle = array of linestyle numbers  If linestyle(i) < 0, then omit 
		ith symbol or line to allow a multi-line entry.
	psym = array of plot symbol numbers.  If psym(i) is negative, then a
		line connects pts for ith item.  If psym(i) = 8, then the
		procedure usersym is called with vertices define in the 
		keyword usersym.
	N. B.: Choose either linestyle, psym, neither, or both.  If neither is
		present, only the text is output.  If both linestyle and
		psym parameters are present, they both have to have the
		same number of elements, and normal plot behaviour occurs.
		By default, if psym is positive, you get one point so there is
		no connecting line.
	vectorfont = vector-drawn characters for the sym/line column, e.g.,
		['!9B!3','!9C!3','!9D!3'] produces an open square, a checkmark,
		and a partial derivative, which might have accompanying items
		['BOX','CHECK','PARTIAL DERIVATIVE'].  If vectorfont(i) = '',
		then plots is called to make a symbol or a line, but if
		vectorfont(i) is a non-null string, then xyouts is called.
		There is no check that !p.font is set properly, e.g., -1 for
		X and 0 for PostScript.  This can produce an error, e.g., use
		!20 with PostScript and !p.font=0, but allows use of Hershey
		*AND* PostScript fonts together.
 Optional Keywords:
	/help = flag to print header
	/horizontal = flag to make the legend horizontal
	/vertical = flag to make the legend vertical (D=vertical)
	box = flag to include/omit box around the legend (D=include)
	delimiter = embedded character(s) between symbol and text (D=none)
	colors = array of colors for plot symbols/lines (D=!color)
	textcolors = array of colors for text (D=!color)
	margin = margin around text measured in characters and lines
	spacing = line spacing (D=bit more than character height)
	pspacing = psym spacing (D=3 characters)
	charsize = just like !p.charsize for plot labels
	position = normalized coordinates of the upper left of the legend
	number = number of plot symbols to plot or length of line (D=1)
	usersym = 2-D array of vertices, cf. usersym in IDL manual. (D=square)
	/fill = flag to fill the usersym
 Outputs:
	legend to current plot device
 Optional Output Keywords:
	corners = 4-element array, like !p.position, of the normalized
	  coords for the box (even if box=0): [llx,lly,urx,ury].
	  Useful for multi-column or multi-line legends, for example,
	  to make a 2-column legend, you might do the following:
	    c1_items = ['diamond','asterisk','square']
	    c1_psym = [4,2,6]
	    c2_items = ['solid','dashed','dotted']
	    c2_line = [0,2,1]
	    legend,c1_items,psym=c1_psym,corners=c1,box=0
	    legend,c2_items,line=c2_line,corners=c2,box=0,pos=[c1(2),c1(3)]
	    c = [c1(0)c2(2),c1(3)>c2(3)]
	    plots,[c(0),c(0),c(2),c(2),c(0)],[c(1),c(3),c(3),c(1),c(1)],/norm
	  Useful also to place the legend.  Here's an automatic way to place
	  the legend in the lower right corner.  The difficulty is that the
	  legend's width is unknown until it's is plotted.  In this example,
	  the legend is plotted twice: the first time in the upper left, the
	  second time in the lower right.
	    legend,['1','22','333','4444'],linestyle=indgen(4),corners=corners
			; BOGUS LEGEND---FIRST TIME TO REPORT CORNERS
	    xydims = [corners(2)-corners(0),corners(3)-corners(1)]
			; SAVE WIDTH AND HEIGHT
	    chdim=[!d.x_ch_size/float(!d.x_size),!d.y_ch_size/float(!d.y_size)]
			; DIMENSIONS OF ONE CHARACTER IN NORMALIZED COORDS
	    pos = [!x.window(1)-chdim(0)-xydims(0) $
			,!y.window(0)+chdim(1)+xydims(1)]
			; CALCULATE POSITION FOR LOWER RIGHT
	    plot,findgen(10)	; SIMPLE PLOT; YOU DO WHATEVER YOU WANT HERE.
	    legend,['1','22','333','4444'],linestyle=indgen(4),pos=pos
			; REDO THE LEGEND IN LOWER RIGHT CORNER
	  You can modify the pos calculation to place the legend where you
	  want.  For example to place it in the upper right:
	    pos = [!x.window(1)-chdim(0)-xydims(0),!y.window(1)-xydims(1)]
 Common blocks:
	none
 Procedure:
	If keyword help is set, call doc_library to print header.
	See notes in the code.
 Restrictions:
	Here are some things that aren't implemented.
	- It would be nice to allow data and device coords as well.
	- An orientation keyword would allow lines at angles in the legend.
	- An array of usersyms would be nice---simple change.
	- An order option to interchange symbols and text might be nice.
	- Somebody might like double boxes, e.g., with box = 2.
	- Another feature might be a continuous bar with ticks and text.
	- There are no guards to avoid writing outside the plot area.
	- There is no provision for multi-line text, e.g., '1st line!c2nd line'
	  Sensing !c would be easy, but !c isn't implemented for PostScript.
	  A better way might be to simply output the 2nd line as another item
	  but without any accompanying symbol or linestyle.  A flag to omit
	  the symbol and linestyle is linestyle(i) = -1.
 Side Effects:
 Modification history:
	write, 24-25 Aug 92, F K Knight (knight@ll.mit.edu)
	allow omission of items or omission of both psym and linestyle, add 
	  corners keyword to facilitate multi-column legends, improve place-
	  ment of symbols and text, add guards for unequal size, 26 Aug 92, FKK
	add linestyle(i)=-1 to suppress a single symbol/line, 27 Aug 92, FKK
	add keyword vectorfont to allow characters in the sym/line column,
	  28 Aug 92, FKK
	Removed default Usersym defintion  W. Landsman  HSTX   July, 1993

(See /usr/local/idl/lib/zastron/plot/legend.pro)


LEGENDTEST

[Previous Routine] [Next Routine] [List of Routines]
 Name:
	legendtest
 Purpose:
	Test the legend procedure.
 Usage:
	.run legendtest
 Inputs:
	none
 Optional Inputs:
	none
 Keywords:
	none
 Outputs:
	legends of note
 Common blocks:
	none
 Procedure:
 Side Effects:
	Sets !20 font to symbol if PostScript and !p.font=0.
 Restrictions:
	With the vectorfont test, you'll get different results for PostScript
	depending on the value of !p.font.
 Modification history:
	write, 27 Aug 92, F.K.Knight (knight@ll.mit.edu)

(See /usr/local/idl/lib/zastron/plot/legendtest.pro)


OPLOTERR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	OPLOTERR
 PURPOSE:
	Over-plot data points with accompanying X or Y error bars.

 CALLING SEQUENCE:
	oploterr, [ x,]  y, [xerr], yerr  [,/NOHAT, HATLENGTH= ,
		 ERRTHICK= , ERRSTYLE= ]
 INPUTS:
	X = array of abcissae, any datatype except string
	Y = array of Y values, any datatype except string
	XERR = array of error bar values (along X)
       YERR = array of error bar values (along Y)

 OPTIONAL INPUT KEYWORD PARAMETERS:
	NOHAT     = if specified and non-zero, the error bars are drawn
	            without hats.
	HATLENGTH = the length of the hat lines used to cap the error bars.
	            Defaults to !D.X_VSIZE / 100).
	ERRTHICK  = the thickness of the error bar lines.  Defaults to the
	            THICK plotting keyword.
	ERRSTYLE  = the line style to use when drawing the error bars.  Uses
	            the same codes as LINESTYLE.

	The keywords available to the OPLOT procedure may also be specified
	(see Appendix D in the IDL User's Guide).  The CLIP keyword is
	specifically unavailable:  To modify this, it is necessary to change 
       !P.CLIP.

 NOTES:
       If only two parameters are input, they are taken as Y and YERR
       If only three parameters are input, they will be taken as X, Y and
       YERR respectively.

 EXAMPLE:
       Suppose one has X and Y vectors with associated errors XERR and YERR
       (1) Overplot Y vs. X with both X and Y errors and no lines connecting
           the points
                  IDL> oploterr, x, y, xerr, yerr, psym=3
       (2) Like (1) but overplot only the Y errors bars and omits "hats"
                  IDL> oploterr, x, y, yerr, psym=3, /NOHAT

 PROCEDURE:
	A plot of X versus Y with error bars drawn from Y - YERR to Y + YERR
	and optionally from X - XERR to X + XERR is written to the output device

 MODIFICATION HISTORY:
	Adapted from the most recent version of PLOTERR.  M. R. Greason,
		Hughes STX, 11 August 1992.
       Removed spurious keywords for IDL V3.0.0  W. Landsman Jan. 1993 
	Added ability to plot a single point W. Landsman   July 1993
	Added COLOR keyword option to error bars W. Landsman   November 1993

(See /usr/local/idl/lib/zastron/plot/oploterr.pro)


PLOTERR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PLOTERR
 PURPOSE:
	Plot data points with accompanying X or Y error bars.

 CALLING SEQUENCE:
	ploterr, [ x,]  y, [xerr], yerr [, TYPE =, /NOHAT, HATLENGTH= ,
		 ERRTHICK=, ERRSTYLE= ]

 INPUTS:
	X = array of abcissae.
	Y = array of Y values.
	XERR = array of error bar values (along X)
	YERR = array of error bar values (along Y)

 OPTIONAL INPUT KEYWORD PARAMETERS:
	TYPE = type of plot produced.  The possible types are:
		TYPE = 0 :	X Linear - Y Linear  (default)
		TYPE = 1 :	X Linear - Y Log
		TYPE = 2 :	X Log    - Y Linear
		TYPE = 3 :	X Log    - Y Log
	       Actually, if 0 is specified, the XTYPE and YTYPE keywords
	       are used.  If these aren't specified, then a linear-linear
	       plot is produced.  This keyword is available to maintain
	       compatibility with the previous version of PLOTERR.
	NOHAT     = if specified and non-zero, the error bars are drawn
	            without hats.
	HATLENGTH = the length of the hat lines used to cap the error bars.
	            Defaults to !D.X_VSIZE / 100).
	ERRTHICK  = the thickness of the error bar lines.  Defaults to the
	            THICK plotting keyword.
	ERRSTYLE  = the line style to use when drawing the error bars.  Uses
	            the same codes as LINESTYLE.

	The keywords available to the PLOT procedure may also be specified
	(see Appendix D in the IDL User's Guide).  There are two that are
	specifically unavailable:  POSITION and CLIP.  To modify these, it
	is necessary to change the appropriate system variables.

 RESTRICTIONS:
	Arrays must not be of type string.  There must be enough points to
	plot.
	If only three parameters are input, they will be taken as X, Y and
	YERR respectively.

 EXAMPLE:
       Suppose one has X and Y vectors with associated errors XERR and YERR

       (1) Plot Y vs. X with both X and Y errors and no lines connecting
           the points
                  IDL> ploterr, x, y, xerr, yerr, psym=3

       (2) Like (1) but plot only the Y errors bars and omits "hats"
                  IDL> ploterr, x, y, yerr, psym=3, /NOHAT

 PROCEDURE:
	A plot of X versus Y with error bars drawn from Y - YERR to Y + YERR
	and optionally from X - XERR to X + XERR is written to the output device

 MODIFICATION HISTORY:
	William Thompson	Applied Research Corporation  July, 1986
	DMS, April, 1989	Modified for Unix
	Michael R. Greason	ST Systems
	May, 1991		Added most of the plotting keywords, put hats
				on the error bars.
	Wayne Landsman          Added call to PLOT_KEYWORDS   Jan, 1992
	K. Venkatakrishna       Added option to plot xerr, May, 1992
	Michael R. Greason	Corrected handling of reversed axes.  Aug. 1992.

(See /usr/local/idl/lib/zastron/plot/ploterr.pro)


PLOTHIST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PLOTHIST
 PURPOSE:
	Plot the histogram of an array with the corresponding abcissa.

 CALLING SEQUENCE:
	plothist, arr, xhist, yhist, [, BIN=bin,   ... plotting keywords]

 INPUTS:
	arr - The array to plot the histogram of.   It can include negative
		values, but non-integral values will be truncated.              

 OPTIONAL OUTPUTS:
	xhist - X vector used in making the plot  
		( = indgen( N_elements(h)) * bin + min(arr) )
	yhist - Y vector used in making the plot  (= histogram(arr/bin))

 OPTIONAL INPUT KEYWORDS:
	BIN -  The size of each bin of the histogram,  scalar (not necessarily
		integral).  If not present (or zero), the bin size is set to 1.

		Any input keyword that can be supplied to the PLOT procedure
		can also be supplied to PLOTHIST.
 EXAMPLE:
	Create a vector of 1000 values derived from a gaussian of mean 0,
	and sigma of 1.    Plot the histogram of these value with a bin
	size of 0.1

	IDL> a = randomn(seed,1000)
	IDL> plothist,a, bin = 0.1

 MODIFICATION HISTORY:
	Written     W. Landsman            January, 1991

(See /usr/local/idl/lib/zastron/plot/plothist.pro)


PLOTSYM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PLOTSYM
 PURPOSE:
	Define useful plotting symbols not in the standard !PSYM definitions.
	After symbol has been defined with PLOTSYM, a plotting command should
	follow with either PSYM = 8 or !P.PSYM = 8 (see USERSYM)

 CALLING SEQUENCE:
	PLOTSYM, PSYM,[ PSIZE, /FILL]

 INPUTS:
	PSYM -  The following integer values of PSYM will create the 
		corresponding plot symbols
		0 - circle
		1 - downward arrow (upper limit), base of arrow begins at plot
			value
		2 - upward arrow (lower limt) 
		3 - 5 pointed star
		4 - triangle
		5 - upside down triangle
		6 - left pointing arrow
		7 - right pointing arrow
	Arrows are defined such that their base begins at their origin.

 OPTIONAL INPUTS:
	PSIZE - Size of the plotting symbol in multiples of the default size
		(default PSIZE=1).  Does not need to be an integer

 OPTIONAL INPUT KEYWORD:
	FILL -  Parameter indicating whether to fill the symbol (see USERSYM)
		The default is 0, unfilled symbol.  Does not affect arrows
		or character symbols.

 OUTPUTS:
	None

 EXAMPLES:
	Plot Y vs. X with filled stars as the symbol, twice the default size
	IDL> PLOTSYM, 3 ,2, /FILL        ;Plotting symbol is a filled star, 
					;twice default size
	IDL> PLOT,X,Y,PSYM=8             ;Set PSYM = 8 to get star symbol

	Now plot Y vs. X with open circle as the symbol
	IDL> PLOTSYM, 0               ;Plotting symbol is a circle 
	IDL> PLOT,X,Y,PSYM=8     

 METHOD:
	Appropiate X,Y vectors are used to define the symbol and passed to the
	USERSYM command.

 REVISION HISTORY
   Written       W. Landsman         June 1992

(See /usr/local/idl/lib/zastron/plot/plotsym.pro)


PLOT_KEYWORDS

[Previous Routine] [List of Routines]
 NAME:
	PLOT_KEYWORDS
 PURPOSE:
	Return default value(s) of plotting keywords.    Useful inside of
	a plotting procedure.

 CALLING SEQUENCE:
	plot_keywords, [BACKGROUND =, CHANNEL =, CHARSIZE =, CHARTHICK =,
		COLOR = , DATA = , DEVICE = , FONT = , LINESTYLE =, NOCLIP = ,
		NODATA = , NOERASE = , NORMAL =, NSUM = , PSYM =, SUBTITLE =,
		SYMSIZE = , T3D = , THICK = , THICKLEN = , TITLE = , XCHARSIZE=,
		XMARGIN =, XMINOR =, XRANGE =, XSTYLE = , XTICKLEN =, 
		XTHICK = ,XTICKNAME =, XTICKS = , XTICKV = , XTITLE =, XTYPE =, 
		YCHARSIZE = , YMARGIN = ,YMINOR = , YNOZERO = , YRANGE = , 
		YSTYLE =, YTHICK =, YTICKLEN = ,YTICKNAME =, YTICKS =,  
		YTICKV =, YTITLE = , YTYPE = ]

 INPUT - OUTPUTS:
	None.

 OPTIONAL OUTPUT KEYWORDS:
	Any of the plotting keywords above.   These keywords are all recognized 
	by the PLOT procedure, and listed in Appendix D.2 of the IDL manual.
	PLOT_KEYWORDS does *not* include any of the Z axis keywords used
	for 3-d plotting.

	An undefined variable assigned to the keyword will be returned with the 
	default value, usually from the correpsonding system variable.

 EXAMPLE:
	Suppose that one has a procedure PLOT_PROC that will make a call
	to the IDL PLOT procedure.    One wishes to include the optional 
	plot keywords XRANGE and YRANGE in PLOT_PROC and pass these to PLOT

	pro plot_proc, XRANGE = xrange, YRANGE = yrange
	......
	plot_keywords, XRANGE = xran, $      ;Get default values if user did
			YRANGE = yran         ;not supply any values
	plot,.... XRANGE = xran, YRANGE = yran         ;Pass to PLOT procedure

 NOTES:
	Plotting keywords that return values (such as XTICK_GET) are not 
	included since there is no need to specify a default.

	The default of XTYPE is 0 and not !X.TYPE

 MODIFICATION HISTORY:
	Written    Wayne Landsman                January, 1991
	Modified default for XTYPE and YTYPE
	Switched from keyword_set to N_elements.  Corrected a LINESTYLE error.
		Michael R. Greason, Hughes STX, 24 March 1993.

(See /usr/local/idl/lib/zastron/plot/plot_keywords.pro)