call opngks !place before any plotting routine calls
Next you have to map x,y ranges to the screen coordinates. By
default the screen coordinates go from 0 to 1 in both the x and y
dimensions, as measured from lower left corner. Example:
call set(0.1,0.9,0.2,0.8,-10.,10.,-5.,5.,1)
! this call uses 1/10 to 9/10 of the way across screen in x
(Left to Right)
! this call uses 2/10 to 8/10 of the way across screen in y
(going bottom to top)
! this call maps x range from -10 to +10 to the range of 1st 2
arguments.
! this call maps y range from -5 to +5 to the range of 3rd & 4th
arguments.
! fortran code, including your plot calls go in here....
call frame ! advance to next 'frame' as if your plots are
going onto a strip of film
Note that you may call frame multiple times to create multiple
plots. Each call dumps the plot buffer created since the last prior
call to frame, or start of your program.
call clsgks !place after all plotting routine calls
! must assign a character variable to put your encoded text
character*10 chrs ! variable chrs can hold 10 characters
to write a variable and a label:
t=3.5 ! anything that fits the format in the write below:
write(chrs,'(6htime = ,f4.2)')t
! the write statement should encode "time = " then value of t
in format f4.2
Now plot the character string at the location xl, yl which
should appear on your plot where you mapped the x,y ranges with your
set call.
call plchhq(xl,yl,chrs,16.,0.,0.)
! assume a set call has been made such as:
call set(0.,1.,0.,1.,0.,1.,2.,4.,1)
! Notice that the entire screen scales with these ranges:
0. <= x <= 1. and 2. <= y <= 4.
! draw a horizontal line from the middle to the top
call line(0.5,3.0,0.5,4.)
! draw a diagonal line from the middle to the lower left corner
call line(0.5,3.0,0.,2.)
Back to ATM 150 homepage