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

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

; Define variables.

@plot01

; Use the LINFIT function to fit the data to a line.

COEFF = LINFIT(YEAR, SOCKEYE)

; YFIT is the fitted line.

YFIT = coeff(0) + coeff(1)*YEAR

;Plot the original data points with PSYM = 4, for diamonds.

PLOT, YEAR, SOCKEYE, /YNOZERO, PSYM = 4, $
    TITLE = 'Linear Fit', XTITLE = 'Year', $
    YTITLE = 'Fish (thousands)'	

;Overplot the smooth curve using a plain line.

OPLOT, YEAR, YFIT
