This module discusses how to send your view objects to an output workstation for viewing.
There are three different types of workstation classes you can use for creating workstation objects for sending view objects to:
Only one NcgmWorkstation can be created at a time in an application, but up to 15 independent XWorkstations or PSWorkstations can be created.
Workstations are created in NCL by using the create expression. For example, the following code would create an instance of a PostScript workstation that produces EPS.
xworkid = create "simple" psWorkstationClass defaultapp "wkPSFormat" : "EPS" "wkBackgroundColor" : (/ 1., 1., 1. /) end create
The workstation name "simple" is used as the base name for the EPS output, so that when view objects are drawn to xworkid, the output file will have the name "simple.eps".
For most applications, you will call the NCL procedure frame after a draw in order to terminate an image. For more precise control, you may want to use the NCL procedures update and clear.
Here is a simple example of sending the same object to two different workstations:
; ; Create a PS output workstation with a white background color. ; psworkid = create "simple" psWorkstationClass defaultapp "wkBackgroundColor" : (/ 1., 1., 1. /) end create ; ; Create an X11 workstation. ; xworkid = create "X11" xWorkstationClass defaultapp "wkPause" : "True" "wkBackgroundColor" : (/ 1., 1., 1. /) end create ; ; Create data for an XyPlot ; dataid = create "xyData" coordArraysClass defaultapp "caXArray": (/0.0, 0.1, 0.5, 0.9, 1.0, 0.9, 0.5, 0.1, 0.0/) "caYArray": (/0.5, 0.9, 1.0, 0.9, 0.5, 0.1, 0.0, 0.1, 0.5/) end create ; ; Create a simple XyPlot object. ; plot_id = create "Box" xyPlotClass xworkid "xyCoordData": dataid end create ; ; Send the XyPlot to the X11 workstation. ; draw(plot_id) frame(xworkid) ; ; Send the XyPlot to the PS workstation. ; NhlChangeWorkstation(plot_id,psworkid) draw(plot_id) frame(psworkid)
NG4.1 Home, Index, Examples, Glossary, Feedback, UG Contents, UG WhereAmI?