;  $Id: //depot/idl/IDL_71/idldir/examples/doc/plot/plot02#1 $

;  Copyright (c) 2005-2009, ITT Visual Information Solutions. All
;       rights reserved.
; 
; This batch file creates a PostScript file of the plot created in
; Chapter 10, "Plotting", of _Using IDL_.

; First, store the current graphics device.

old_dev=!D.NAME

; Set the current graphics device to PostScript.

SET_PLOT, 'PS'

; Use hardware fonts.

!P.FONT=0

; Specify a filename for the PostScript file we will create. The
; file will be placed IDL's current working directory when this
; batch file is run. Select the Times Roman PostScript font.

DEVICE, FILE='plot.ps', /TIMES

; Run a batch file to define the variables used to create the plot.

@plot01

; Store the index of the last point in the variable N1.

N1 = N_ELEMENTS(YEAR) - 1

; Plot first graph. Set the y-axis min and max from the min and max of 
; all data sets. The default linestyle is 0.

PLOT, YEAR, COHO, YRANGE = [MIN(ALLPTS), MAX(ALLPTS)], $
    TITLE='Salmon Populations', XTITLE = 'Year', YTITLE = 'Fish (thousands)', $
    XRANGE = [1965, 1990], /XSTYLE	

; Loop for the three remaining scores, varying the linestyle. 

FOR I = 1, 3 DO OPLOT, YEAR, ALLPTS(*, I), LINESTYLE = I

; Append the title of each graph on the right. 

FOR I = 0, 3 DO XYOUTS, 1984, ALLPTS(N1, I), NAMES(I)

; Close the PostScript file.

DEVICE, /CLOSE

; Use vector fonts.

!P.FONT=1

; Set the current graphics device back to its original setting.

SET_PLOT, old_dev
