clear dire
define real xmin1 xmin2 xmin3 xmax1 xmax2 xmax3
define real ymin1 ymin2 ymin3 ymax1 ymax2 ymax3
let xmin1 1.
let xmax1 9.
let xmin2 10.
let xmax2 19.
let xmin3 20.
let xmax3 29.
let ymin1 14.5
let ymax1 19.5
let ymin2 8.
let ymax2 13.
let ymin3 1.5
let ymax3 6.5
!
! --- Ellipse ----------------------------------------------------------
g\set box_loc xmin1 xmax1 ymin1 ymax1
g\draw text 0. .35 "ELLIPSE(s)" /box 8
g\draw text 0. -.35 "default" /box 2
g\limits -1. 1. -.75 .75
g\draw relo .3 .3 /user
g\ellipse .5 .3 45.
g\draw relo .3 -.3 /user
g\ellipse .5 .3 -45.
g\draw relo -.3 0. /user
g\ellipse .5 .3 0.
!
g\set box_loc xmin1 xmax1 ymin2 ymax2
g\draw text 0. -.35 "/FILL" /box 2
g\draw relo .3 .3 /user
g\ellipse .5 .3 45. /fill 1
g\draw relo .3 -.3 /user
g\ellipse .5 .3 -45. /fill 2
g\draw relo -.3 0. /user
g\ellipse .5 .3 0. /fill 3
!
g\set box_loc xmin1 xmax1 ymin3 ymax3
g\draw text 0. -.35 "/HATCH" /box 2
! 3 hatching pattern, shifted by 1/3 each
g\draw relo .3 .3 /user
g\ellipse .5 .3 45. /hatch 1 45. .2 0.
g\draw relo .3 -.3 /user
g\ellipse .5 .3 -45. /hatch 2 45. .2 .333
g\draw relo -.3 0. /user
g\ellipse .5 .3 0. /hatch 3 45. .2 .667
!
! --- Polygon ----------------------------------------------------------
! Define the polygon in a variable and in a file, and test both
define real xypol[50,2] phase
for i 1 to 25
  let phase (i-1)*3*pi/24.
  let xypol[i,1] i
  let xypol[i,2] sin(phase)
  let xypol['51-i',1] i
  let xypol['51-i',2] -sin(phase)
next
sic out gag_scratch:demo-polygon.pol
for i 1 to 50
  say 'xypol[i,1]' 'xypol[i,2]'
next
sic out
!
g\set box_loc xmin2 xmax2 ymin1 ymax1
g\draw text 0. .35 "POLYGON" /box 8
g\draw text 0. -.35 "/PLOT" /box 2
g\limits 0. 27. -1.1 1.1
g\polygon xypol /varia /plot
!
g\set box_loc xmin2 xmax2 ymin2 ymax2
g\draw text 0. -.35 "/PLOT + /FILL" /box 2
g\polygon gag_scratch:demo-polygon.pol /plot /fill 1
!
g\set box_loc xmin2 xmax2 ymin3 ymax3
g\draw text 0. -.35 "/PLOT + /FILL + /HATCH" /box 2
! All in one call:
g\polygon xypol /varia /plot /fill 1 /hatch 3 90. .25 0.
!
sic delete gag_scratch:demo-polygon.pol
!
! --- Histogram --------------------------------------------------------
define real x[10] y[10]
let x[i] i
let y 1. 2. -1000. 4. 3. 6. 7. 2. 0./0. 5.
!
g\set box_loc xmin3 xmax3 ymin1 ymax1
g\draw text 0. .35 "HISTOGRAM" /box 8
g\draw text 0. -.35 "default" /box 2
g\limits 0. 11. 0. 8.
g\histo x y /blank -1000. 0.
g\box n n
!
g\set box_loc xmin3 xmax3 ymin2 ymax2
g\draw text 0. -.35 "/FILL" /box 2
g\histo x y /blank -1000. 0. /fill 1 /base 0.
g\box n n
!
g\set box_loc xmin3 xmax3 ymin3 ymax3
g\draw text 0. -.35 "/BASE + /HATCH + /HATCH" /box 2
! Cross-hatched pattern: 2 calls
g\histo x y /blank -1000. 0. /hatch 1 45. .25 0.
g\histo x y /blank -1000. 0. /hatch 1 -45. .25 0.
g\histo x y /blank -1000. 0. /base 0.
g\box n n

