box_id = create "Box" tickMarkClass xworkid "tmXBDataLeftF": 0. "tmXBDataRightF": 1. "tmYLDataTopF": 1. "tmYLDataBottomF": 0. "tmYLLabelsOn": "False" end create
In this example, box_id is returned as the object id of the TickMark object that is created; "Box" is the name of the created object; tickMarkClass is the class of object being created; xworkid is an id of an object to be used as the parent of the object being created. In this case, xworkid would be an object identifier for an X11 workstation that would need to have been created before the above create is done. Note how easy it is to specify values for resources in NCL creates.
setvalues box_id "tmXBDataLeftF": -1. end setvalues
Values for HLU resources can also be assigned via a resource file as well as in the NCL visualization blocks. For details on setting values for resources, see the document Understanding resources in the HLU User Guide. To set resource values via a resource file, you must create an App object to supply the base name of the resource file. For example, the following NCL create expression would provide access to a resource file named "my_resources.res":
appid = create "my_resources" appClass defaultapp "appDefaultParent" : "True" end create
getvalues box_id "tmXBDataLeftF": x_left_value end getvalues
would return the current value for tmXBDataLeftF in the NCL variable x_left_value.
A thorough description of overlays and annotations is contained in the reference page for PlotManager.
Presented below is a very simple example of how to use the NCL overlay procedure. This example is for illustration only, since you would not want to create an overlay to do what it does (superimpose a curve on a background box). You would just use a single XyPlot object to do this. For more sophisticated examples of using overlays, see cn05n.ncl, xy10n.ncl, and mp03n.ncl. The Quick Start Guide explains how to run these examples.
; ; Simple example of using the NCL overlay procedure. This example ; is for illustration only - it does not reflect real-world usage. ; ; ; Create an X11 output workstation. ; xworkid = create "simple" xWorkstationClass defaultapp "wkPause" : "True" end create ; ; Create an XyPlot object that is just a box. This object will be ; used as the base plot. ; box_id = create "Box" xyPlotClass xworkid "tmXBLabelsOn": "False" "tmYLLabelsOn": "False" "tmXBOn": "False" "tmXTOn": "False" "tmYLOn": "False" "tmYROn": "False" ; ; Specify the plot limits to conform with those of the subsequent overlay. ; "trXMinF": -1. "trXMaxF": 1. "trYMinF": 0. "trYMaxF": 1. end create ; ; Create data for another XyPlot object that is simply a curve. This ; object will be used as an overlay to the base plot. ; dataid = create "xyData" coordArraysClass defaultapp "caXArray": (/ -1., 0., 1./) "caYArray": (/ 0., 1., 0./) end create ; ; Create the XyPlot overlay (by default PlotManager will not ; create a TickMark object for this object since pmTickMarkDisplayMode ; is set to "NoCreate"). ; curve_id = create "Curve" xyPlotClass xworkid "xyCoordData": dataid end create ; ; Overlay the curve on the box. ; overlay(box_id,curve_id) ; ; Draw the plot which is the curve overlaid on the box. ; draw(box_id) frame(xworkid)
NG4.1 Home, Index, Examples, Glossary, Feedback, UG Contents, UG WhereAmI?