Manipulating images

This module discusses how to plot and position your viewable objects on an output workstation. It also discusses how to modify and redraw an object once it has been created.

Positioning images

In order to plot an object on an output workstation, that object has to be a view object. To position a view object on an output workstation, you use the viewClass resources vpXF, vpYF, vpWidthF, and vpHeightF. The resources vpXF and vpYF specify a coordinate point in NDC space that references the upper left corner of the plot object on an output workstation. The viewClass resource vpWidthF specifies how wide the view object will be (again in NDC units), and vpHeightF specifies how tall the view object will be. For example, the settings:

      "vpXF": .4
      "vpYF": .6
      "vpWidthF": .3
      "vpHeightF": .3

would specify that the view object would be displayed with its upper left corner at NDC coordinate (0.4, 0.6) in a square of size 0.3 NDC units.

If vpWidthF and vpHeightF do not specify a square, then the view object will be made to fit into the specified rectangle, unless the viewClass resource vpKeepAspect is set to "True", in which case the view object will be constrained to fit in the largest box, with aspect ratio matching the original shape, that can be inscribed within a box of the specified size. vpKeepAspect is "False" by default, so that a view object will be made to fit the rectangle specified by vpWidthF and vpHeightF.

If the view object is positioned so that part (or all) of it would go outside of NDC limits, then the object is scaled in such a manner to make it fit in NDC space. A warning message is issued in this case.

Modifying images

Once an object is created and plotted to an output workstation, its resources can be modified and the object redrawn. In particular, the positioning resources, mentioned in the above paragraphs, can be modified and the object redrawn.

The NCL expression to use to modify resources in an object that has been created is setvalues. For example, suppose that an XyPlot object has been created and you want to reposition it for plotting to an output workstation. You can do this with the following:

  setvalues id_of_object
    "vpXF": new_xpos
    "vpYF": new_ypos
    "vpWidthF": new_width
    "vpHeightF": new_height
  end setvalues

Example

The topics in this module are illustrated in the NCL example basic06n. This example also illustrates setting up a color table and changing colors of items in objects and redrawing the objects. The Quick Start Guide explains how to run this example.

User Guide Control Panel

NG4.1 Home, Index, Examples, Glossary, Feedback, UG Contents, UG WhereAmI?


$Revision: 1.7 $ $Date: 1998/06/15 22:08:45 $