NCL Home > Documentation > Graphics > Graphical Interfaces


Draws a filled polygon on the given workstation.


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"  ; This library is automatically loaded
                                                          ; from NCL V6.2.0 onward.
                                                          ; No need for user to explicitly load.

	procedure gsn_polygon_ndc (
		wks [1] : graphic,  
		x   [*] : numeric,  
		y   [*] : numeric,  
		res [1] : logical   



A Workstation identifier. The identifier is one returned either from calling gsn_open_wks or calling create to create a Workstation object.


One-dimensional arrays of the same length containing the X and Y coordinates of the polygon, which must be normalized device coordinates (NDC).


A variable containing an optional list of polygon resources, attached as attributes. Set to True if you want the attached attributes to be applied, and False if you either don't have any resources to set, or you don't want the resources applied.


If a missing value is encountered in x and/or y, then this pair is ignored, but the polygon will still be filled.

There are many fill patterns available, and you can use the gsFillIndex resource to change the fill pattern. The default is a solid fill. You can change the color of the fill via the gsFillColor resource.

See Also

gsn_polygon, gsn_polymarker, gsn_polyline, gsn_polymarker_ndc, gsn_polyline_ndc, gsn_add_polygon, gsn_add_polymarker, gsn_add_polyline, gsn_text, gsn_text_ndc, gsn_add_text, gsn_table, drawNDCGrid, gsn_add_shapefile_polylines, gsn_add_shapefile_polymarkers, gsn_add_shapefile_polygons, NhlNewMarker, NhlNewDashPattern


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  wks = gsn_open_wks("x11","gsn_polygon_ndc")    ; Open a workstation.
  cirx = (/ .415, .326, .225, .159, .159, .225, .326, .415, .450/)
  ciry = (/ .846, .898, .880, .801, .699, .620, .602, .654, .750/)

  gsres = True             ; Indicate you want to set some resources.
  gsres@gsFillColor = 4    ; Change fill color.

  gsn_polygon_ndc(wks,cirx,ciry,gsres)  ; Draw a filled polygon.
  frame(wks)                            ; Advance the frame.