NCL Home > Documentation > Functions > Graphics routines

drawNDCGrid

Draws NDC grid lines at 0.1 NDC coordinate intervals and labels them.

Prototype

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"      ; These four libraries are automatically
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"       ; loaded from NCL V6.4.0 onward.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"   ; No need for user to explicitly load.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

	procedure drawNDCGrid (
		wks  : graphic   
	)

Arguments

wks

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

Description

This procedure draws NDC grid lines at 0.1 NDC coordinate intervals and labels them. This procedure is useful to help determine placement of labels and lines on plots when using functions like gsn_add_text.

The frame is not advanced in this procedure.

Examples

Example 1

  f  = addfile ("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r")
  x  = f->U(1,:,:)       ; Grab second timestep

  wks = gsn_open_wks("x11","test")

;---Create contours over a map and draw an NDC grid
  res = True
  res@gsnFrame = False
  plot = gsn_csm_contour_map(wks,x,res)                                           
  drawNDCGrid(wks)

;---Draw a text string centered (X NDC=0.5) near the bottom of the page (Y NDC=0.2)
  txres = True
  txres@txFontHeightF = 0.015
  gsn_text_ndc(wks,"Now I can exactly place the text where I want it to be!",0.5,0.2,txres)
  frame(wks)       

For other application examples, see the list of example NCL scripts that drawNDCGrid appears in.