;--------------------------------------------------------------------------------
OpenR, lun, 'NPOINT', /Get_Lun ; The file NPOINT
is opened. Instead of you selecting
; a logical unit number, one is selected automatically
Point_Lun, lun, 0
; The pointer is set to the beginning of the file
ReadF, lun, npt
; The opened file is read, and the contents assigned
; to the variable 'npt'
npoint = FIX(npt)
; 'npt' came in as a float, so this coverts it to an
; integer
Free_Lun, lun
; The logical unit number selected for this file is
; freed, thus also closing the file
;--------------------------------------------------------------------------------
; The file to be opened, TRAJ, contains 2 columns of data. Here,
the data is read into a 2 dimensional
; array one dimension for each column of data. The other dimension
is the number of rows of data which
; conveniently came from the file NPOINT and was read as the integer
npoint. This is the most efficient way
; of transferring the data (according to Research Systems, Inc.)
; The array is of type Double because of the precision of the numbers
in the data file requires more than a Float.
OpenR, lun, 'TRAJ', /Get_Lun
Point_Lun, lun, 0
array = DblArr(2, npoint) ; Creates array that
will be filled with 2 columns of data and npoints rows
ReadF, lun, array ; Read the contents
of the files and place the contents into the array just created
XT = array(0,*) ; Create the 1D array XT which contains the
values from the 1st (0) dimension of "array"
YT = array(1,*) ; Create the 1D array YT which contains the
values from the 2nd (1) dimension of "array"
Free_Lun, lun ; The asterisk in the 2 lines above
means 'go from 0th element to nth element
XT = Reform(XY) ; "Reform" changes the array from * columns
to * rows--unnecesary here, but critical
YT = Reform(YT) ; in other examples
;--------------------------------------------------------------------------------
Set_PLOT, 'PS' ; PostScript
is selected
DEVICE, FILENAME = 'plotber.ps', /LANDSCAPE ; The Postscript
filename is selected.
; The file name must have the suffix
DEVICE, /INCHES, XSIZE = 6, YSIZE = 6, $ ; This
sets the size of the graph that is
; printed in the PostScript file. The
; default for PS files is centimeters.
; For graphs plotted to the monitor,
; the x and y sizes are given in pixels.
XOFFSET = 1, YOFFSET = 1 ; Without
listing an offset for the graph, it's location will
; be somewhat arbitrary and possibly with the top cut off.
; Specifying an X and Y offset will position the graph
; relative to the lower left corner (in this case 1" in and
1"
; up.
;--------------------------------------------------------------------------------
; Use the links on the first page to understand this syntax.
Alternatively, use the comments in the "align" example.
Plot, XT, YT, XTITLE = '!BX', YTITLE = '!BY', $
XSTYLE = 1, XRANGE = [XMIN,XMAX],
$
YSTYLE = 1, YRANGE = [YMIN,YMAX],
$
XTICKS = 6, XMINOR = 5, $
YTICKS = 6, YMINOR = 5
XYOUTS, -.3, 1.5, 'PYIN=-0.30'
;--------------------------------------------------------------------------------
DEVICE, /Close_File ;
The PostScript device must be closed before the file can be printed
Spawn, 'lpr plotber.ps' ; The printer is sent
the command to print the file. This will probably print
; on the system printer for the machine you're logged into, rather
than the
; terminal at which you're sitting (unless they are the same)
;--------------------------------------------------------------------------------
END