C	DEMO.FOR:
C	This set of VAX-11 FORTRAN routines demonstrates the individual
C	VPLOT subroutines.  These routines may be "chopped up" into
C	separate programs using an editor, or called one or several at a
C	time from a main program; they lack arguments and should be
C	"callable" [vile "word"!] from VAX-11 FORTRAN, BASIC, or PASCAL
C	programs.  A sample calling program, SAMPL.FOR:
C
C	CALL DPFW
C	CALL SYNUM2
C	CALL DNUMB
C	STOP
C	END
C
C	Then, in command language:
C
C	$ FORTRAN SAMPL
C	$ FORTRAN DEMO
C	$ FORTRAN V2		! if necessary
C	$ MACRO MACPLOT		! if necessary
C	$ LINK SAMPL+DEMO+V2+MACPLOT
C	$ RUN SAMPL
C
C************************************************************************
C
C	DPFW: demonstration of PLOTS,PLOT,FACTOR,WHERE:
	SUBROUTINE DPFW			! no arguments
	CALL PLOTS (9.,8.,2)		! reserve 9" long, 8" wide area
C					  output to FOR002.DAT
	CALL PLOT (2.,2.,2)		! line from (0.,0.) to (2.,2.)
	CALL PLOT (4.,1.,2)		! line from (2.,2.) to (4.,1.)
	CALL PLOT (5.,5.,3)		! pen to (5.,5.); no line drawn
	CALL PLOT (6.,6.,-2)		! line from (5.,5.) to (6.,6.)
C					  (6.,6.) becomes the new origin
C					  and from now on is cdesignated
C					  (0.,0.)
	CALL FACTOR (0.5)		! succeeding pen movements will 
C					  be half as large as stated
	CALL PLOT (3.,-3.,2)		! line from new origin to what is
C					  now (3.,-3.). actual X and Y
C					  distances moved are 1.5" apiece
	CALL WHERE(RX,RY,RF)		! get pen location & scale factor
	TYPE *,'X=',RX,'Y=',RY,'SCALE-FACTOR=',RF
	CALL PLOT (0.,0.,999)		! output call
	RETURN
	END
C
C	SYNUM1:
C	This routine not only demonstrates some abilities of SYMBOL and
C	NUMBER, but also creates a handy guide to the VPLOT character set
C
	SUBROUTINE SYNUM1
	CALL PLOTS (11.,8.5,3)	! reserve 8.5" wide by 11.0" long field
	DO 1 I=1,8
	DO 1 J=1,16
	YP=FLOATJ(I)-.7
	XP=FLOATJ(J)*.6
	NUM=(I-1)*16+J-1
	CALL NUMBER (XP,YP,.1,FLOATJ(NUM),90.,-1)
C	^ plot numerical equivalent of each character: 0.1" high,
C	at 90 degrees, without a decimal point.
	CALL SYMBOL (999.,999.,.2,' ',90.,1)
C	^ plot a space after each number
	CALL SYMBOL (999.,999.,.4,CHAR(NUM),90.,1)
C	^ plot the character after that, but 0.4" high instead of 0.2"
1	CONTINUE
	CALL PLOT (0.,0.,999) ! create output file
	RETURN
	END
C
C	SYNUM2:
C	This routine shows some more of the features of SYMBOL and
C	NUMBER:
	SUBROUTINE SYNUM2
	CALL PLOTS (8.,8.,4)	! reserve 8"x8" plotting area
	DO 1 I=0,315,45
	XI=FLOATJ(I)		! floating-point version of I
	CALL SYMBOL (4.,4.,.3,'  ANGLE= ',XI,1)
C  write '  ANGLE= ', 0.3" high, beginning at (4.,4.) and at an angle of
C  XI degrees.
	CALL NUMBER (999., 999., .3, XI, XI, -1)
C  write the integer part of XI immediately after the next text, .3"
C  high and at an angle of XI degrees.
1	CONTINUE
	CALL PLOT (0.,0.,999)	! create output file FOR004.DAT
	RETURN
	END
C
C	DNUMB:
C	The effects of different values of NDEC and HEIGHT on NUMBER:
C
	SUBROUTINE DNUMB
	CALL PLOTS (8.,8.,7)	! reserve 8"x8" field; output to FOR007.
	Q=3141.593
	CALL NUMBER (1.,1.,.2,Q,90.,3)	! 3 digits to right of d.p.
C					  All digits 0.2" high.
	CALL NUMBER (2.,1.,.3,Q,90.,1)	! 1 digit to right; all 0.3" high
	CALL NUMBER (3.,1.,.5,Q,90.,0)	! decimal point only; 0.5" high
	CALL NUMBER (4.,1.,.7,Q,90.,-1)	! integer w/no d.p.; 0.7" high
	CALL NUMBER (5.,1.,1.2,Q,90.,-3)! 2 digits to the left of the
C		decimal point are truncated, giving a 2-digit number
	CALL PLOT (0.,0.,999)		! create output file FOR007.DAT
	RETURN
	END
C
C	DAXIS:
C	Sample pair of X- and Y-axes, using AXIS:
C
	SUBROUTINE DAXIS
	CALL PLOTS (8.,8.,8)	! 8"x8" field; output to FOR008.DAT
	CALL PLOT (0.5,0.5,-3)	! new origin 0.5" from each edge to
C				  allow room for axis labels
	CALL AXIS (0.,0.,'Y-AXIS',1,6.,90.,100.,.02)
C	^ Axis starts at new origin, is labelled 'Y-AXIS', has annotation
C	on its positive side, is six inches long, and is drawn at an
C	angle of ninety degrees.  First point on axis is marked "100.00,"
C	next "100.02," &c.
C
	CALL AXIS (0.,0.,'X-AXIS',-1,7.,0.,-900.,1000.)
C	^ Start: at new (0.,0.); Label: X-AXIS; Annotation: negative 
C	side; Length: seven inches; Angle: zero degrees. First point is
C	-900.00; next is 100.00, &c.  Actual point labels will be -9.00,
C	1.00, 11.00, &c., with " *10^2 " after the title.
C
	CALL PLOT (0.,0.,999)		!create output file
	RETURN
	END
C
C	DGRAF:
C	Demonstration graph using SCALE, AXIS, and LINE:
C
	SUBROUTINE DGRAF
	DIMENSION X(22),Y(22)	! Arrays for data. Note 2 extra elements.
	CALL PLOTS (11.,8.,10)	! Field reserved. Output to FOR010.DAT.
C				  in each to hold scaling factors.
	DATA X,Y /0.,5.,7.,12.,14.,19.,27.,43.,49.,56.,59.,67.,70.,73.,
	1 77.,79.,82.,85.,93.,97.,2*0.,5.,10.,14.,20.,23.,29.,35.,46.,
	2 53.,57.,69.,78.,84.,89.,93.,105.,125.,156.,197.,228.,2*0./
	CALL PLOT (0.5,0.5,-3)	! ensure that axis labels are visible
	CALL SCALE (Y,6.,20,1)	! scale the 20 points of Y to 6" axis
	CALL AXIS (0.,0.,'Sales of Emperor Penguins Per Year',-1,10.,
	1 0.,0.,10.)
C	^ Axis starts at (0.,0.) and bears the title "Sales of Emperor
C	Penguins Per Year"; it is ten inches long, at zero degrees,
C	and has initial point 0.0 and second point 10.0.  Note that
C	SCALE was not needed for this axis.
C
	CALL AXIS (0.,0.,'Relative Intensity of Fishy Smell',1,6.,90.,
	1 Y(21),Y(22))
C	^ Axis starts at (0.0,0.0), is labelled "Relative Intensity of
C	Fishy Smell," is six inches long, is at ninety degrees, and has
C	scaling constants FIRSTV and DELTAV provided by SCALE.
C
	X(21)=0.
	X(22)=10.	! scaling-factors for X, since SCALE wasn't used
	CALL LINE (X,Y,20,1,1,10)
C	^ Line drawn through twenty points, with plot symbol #10 at each
C	point.
	CALL PLOT (0.,0.,999)
	RETURN
	END
C
C	DCIRCL:
C	A sample of CIRCL's abilities:
C
	SUBROUTINE DCIRCL
	CALL PLOTS (8.5,8.5,11)	! reserve plot area
	DO 1 I=0,2
	T=FLOATJ(I)*90.
	Y=FLOATJ(I)*2.+2.
	CALL CIRCL (2.,Y,T,360.,.4,.4,0.)
C	Draw three circles:
C	1st: start at (2.,2.); THO=0., THF=360., RO & RF=0.4, DI=0.0
C	2nd: start at (2.,4.); THO=90., THF=360., RO & RF=0.4, DI=0.0
C	3rd: start at (2.,6.); THO=180., THF=360., RO & RF=0.4, DI=0.0
1	CONTINUE
	DO 2 I=0,2,2
	T=FLOATJ(I)*360.-360.
	Y=FLOATJ(I+3)
	CALL CIRCL (4.,Y,0.,T,.5,.25,0.)
C	Draw two 360-degree spirals:
C	1st: at (4.,3.); THO=0., THF=360., RO=.5, RF=.25, DI=0.0
C	2nd: at (4.,5.); same except that THF=-360.
2	CONTINUE
C	self-explanatory; the second is an Archimedean spiral...
	CALL CIRCL (6.,2.,0.,360.,.5,.75,0.)
	CALL CIRCL (6.,4.,0.,360.,.5,0.,0.)
	CALL CIRCL (6.,6.,0.,360.,.5,-.5,0.)
	CALL CIRCL (7.,3.,90.,270.,.7,.7,0.)
	CALL CIRCL (7.,5.,90.,270.,.7,.7,0.5)	! same as last but dashed
	CALL PLOT (0.,0.,999)
	RETURN
	END
C
C	DDASHL:
C	A routine using DASHL to plot a dashed line:
C
	SUBROUTINE DDASHL
	DIMENSION X(12),Y(12)
	DATA X /1.,2.,4.,8.,16.,32.,64.,128.,256.,512.,0.,60./
	DATA Y /2.,4.,6.,8.,10.,12.,14.,16.,18.,20.,0.,3./
C	The last two elements of each array are scaling-factors.
	CALL PLOTS (10.,8.,12)
	CALL PLOT (.5,.5,-3)
	CALL DASHL (X,Y,10,1)	! Dashed line between ten points
	CALL PLOT (0.,0.,999)
	STOP
	END
C
C	DDASHP:
C	Demonstration of DASHP:
C
	SUBROUTINE DDASHP
	CALL PLOTS (8.,8.,13)
	CALL PLOT (4.,4.,-3)	! new centre at (4.,4.)
	DO 1 I=0,6
	FI=FLOATJ(I)
	T=FI*0.785398		! or pi/4
	D=FI/10.+.1
	CALL DASHP (3.5*COS(T),3.5*SIN(T),D)
	CALL PLOT (0.,0.,3)
1	CONTINUE
	S2=SQRT(2.)
	CALL DASHP (3.5*S2,-3.5*S2,100.)	! purposely too large
	CALL PLOT(0.,0.,999)
	RETURN
	END
C
C	DELIPS:
C	Effects of different arguments on ELIPS:
C
	SUBROUTINE DELIPS
	CALL PLOTS (10.,8.5,14)
	CALL ELIPS (2.,2.,.6,.4,0.,0.,360.,3)
	CALL ELIPS (2.,4.,.4,.4,0.,0.,360.,3)
C
	CALL ELIPS (4.,2.,.4,.2,90.,0.,360.,3)
	CALL ELIPS (4.,4.,.4,.2,135.,0.,360.,3)
	CALL ELIPS (4.,6.,.4,.2,-135.,0.,360.,3)
C
	CALL ELIPS (6.,2.,.4,.3,90.,30.,210.,3)
	CALL ELIPS (6.,4.,.4,.3,90.,30.,300.,3)
	CALL ELIPS (6.,6.,.4,.3,90.,30.,-240.,3)
C
	CALL ELIPS (8.,3.,.5,.3,0.,0.,180.,3)
	CALL ELIPS (8.,6.,.5,.3,0.,0.,180.,2)
C  a line is drawn from the pen's previous position to the starting
C  point of this elliptical arc.
	CALL PLOT (0.,0.,999)
	RETURN
	END
C
C	DGRID:
C	Some small grids produced by GRID:
C
	SUBROUTINE DGRID
	CALL PLOTS (10.,8.,15)
	CALL GRID (0.,0.,.5,.5,18,7)
C	^ Grid is 9"x3.5", with spacings 0.5"
	CALL GRID (0.,4.,.2,.5,20,6)
C	^ Grid is 4"x3", with x-spacing 0.2", y 0.5"
	CALL GRID (5.,4.,.1,.05,40,60)
C	^ Grid is 4"x3", with x-spacing 0.1", y 0.05"
	CALL PLOT (0.,0.,999)
	RETURN
	END
C
C	DPOLY:
C	Some polgons:
	SUBROUTINE DPOLY
	CALL PLOTS (10.,8.5,16)
	CALL POLY (1.,7.,.3,3.,0.)
	CALL POLY (4.,7.,.6,3.,0.)
	CALL POLY (7.,7.,.8,3.,0.)
C
C
	CALL POLY (1.,5.,.5,4.,0.)
	CALL POLY (4.,5.,.5,5.,0.)
	CALL POLY (7.,5.,.5,6.,0.)
C
C
	CALL POLY (1.,3.,.25,-4.,0.)
	CALL POLY (4.,3.,.25,-5.,0.)
	CALL POLY (7.,3.,.25,-6.,0.)
C
C
	CALL POLY (1.,1.,.5,3.,-45.)
	CALL POLY (4.,1.,.5,3.,90.)
	CALL POLY (7.,1.,.5,3.,120.)
C
	CALL PLOT (0.,0.,999)
	RETURN
	END
C
C	DRECT:
C	Demonstration calls to RECT:
C
	SUBROUTINE DRECT
	CALL PLOTS (8.,8.,17)
	CALL RECT (2.,7.,.25,.5,0.,3)
	CALL RECT (4.,7.,.5,.5,0.,3)
	CALL RECT (6.,7.,.70,.5,0.,3)
C
C
	CALL RECT (2.,5.,.25,.6,-30.,3)
	CALL RECT (4.,5.,.25,.6,45.,3)
	CALL RECT (6.,5.,.25,.6,180.,3)
C
C
	CALL RECT (2.,3.,.01,.4,30.,3)
	CALL RECT (4.,3.,.01,.4,90.,3)
	CALL RECT (6.,3.,.01,.4,240.,3)
C
	CALL RECT (3.,1.,.75,.75,45.,3)
	CALL RECT (5.,1.,.75,.75,45.,2)	! line from previous location
	CALL PLOT  (0.,0.,999)
	RETURN
	END
C
C	DPOLAR:
C	An Archimedean spiral (sort of) drawn by POLAR:
C
	SUBROUTINE DPOLAR
	DIMENSION R(50),A(50)
	CALL PLOTS (10.,8.5,18)
	DO 1 I=1,50
	A(I)=FLOATJ(I)/5.
	R(I)=FLOATJ(I)
1	CONTINUE
	CALL PLOT (4.25,4.25,-3)
	CALL POLAR(R,A,50,1,1,0,4.,0.)
	CALL PLOT (0.,0.,999)
	RETURN
	END
