! testing large number of polygons in a plot.  Map plot has
! 130501 polygons; previously we had an upper limit of 100K polygons

use coads_climatology
def axis/x=0:360:0.5 xq
def axis/y=-90:90:0.5 yq
def axis/y=-90:90:1 yq
let fsst =  sst[l=1,gx=xq,gy=yq]
shade/title="loading polygon at each grid point" sst[l=1]   ! Set up plot params for polymark.jnl

let lon = xsequence(x[gx=xq] + 0*y[gy=yq])
let lat = xsequence(0*x[gx=xq] + y[gy=yq])
go polymark poly/key/pal=dark_land_sea/title="130501 polygons", lon, lat, xsequence(fsst), square, 0.3

! Test that everythings properly reset afterwards. 
! single polygon.

polygon/thick/color=red/palette=blue/axes=1,0,1,0 {1,2,1}, {2,1,0.5}

! Now test that is still also works with the 2-D mode of polygons.

let xtriangle = ysequence({-1,0,1})
let ytriangle = ysequence({-1,1,-1})
let xpts = 180 + 30*randu(i[i=1:10])
let ypts = 30*randu(1+i[i=1:10])
polygon xtriangle+xpts, ytriangle+ypts, i[i=1:10]
