load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin wks = gsn_open_wks("png","poly_example") ;-- set resources res = True res@gsnDraw = False ;-- don't draw the plot yet res@gsnFrame = False ;-- don't advance the frame yet res@mpFillOn = True map = gsn_csm_map(wks,res) ;-- create the map, but don't draw it yet pmres = True ;-- polymarker resources pmres@gsMarkerSizeF = 0.03 ;-- set size of marker pmres@gsMarkerThicknessF = 2.0 ;-- set thickness of marker lines ;---------------------------------------------------------------------- ; If you don't use a unique id when calling gsn_add_polymarker, you ; will get a bunch of warnings: ; ; warning:TransformPostDraw: tfPolyDrawList element 0 is invalid ; warning:TransformPostDraw: tfPolyDrawList element 1 is invalid ; warning:TransformPostDraw: tfPolyDrawList element 2 is invalid ; ; and you won't see all of your markers. ; ; Run the code below and notice how only one of the blue ; markers is visible, but all of the green markers are visible. ;---------------------------------------------------------------------- x = -160. y = -80. mkid2 = new(16,graphic) ; array to hold unique ids for markers do i = 0,15 pmres@gsMarkerIndex = i+1 ;---Reusing the same variable (mkid1) every time. pmres@gsMarkerColor = "blue" mkid1 = gsn_add_polymarker(wks, map, x+(i*20.), y+(i*10.), pmres) ;---Using a unique variable (mkid2(i)) every time. pmres@gsMarkerColor = "forestgreen" mkid2(i) = gsn_add_polymarker(wks, map, x+(i*15.), y+(i*10.), pmres) end do ;-- draw the plot and advance the frame draw(map) frame(wks) end