Transforming iTool Items

The IROTATE, ISCALE, ITRANSLATE, and IZOOM routines allow you to programmatically transform visualizations and annotations in an existing iTool window.

Note on Coordinate Systems

The IROTATE, ISCALE, ITRANSLATE, and IZOOM routines allow you to specify the coordinates of items using three different coordinate: NORMAL, DEVICE, or DATA. The coordinate systems are described in detail in Coordinate Systems.

Translating Items

Use the ITRANSLATE procedure to change the location of a visualization or annotation in the X, Y, or Z plane (or any combination thereof).

For example, the following code creates an iImage tool with a colorbar, which is positioned at the bottom of the screen by default. Using the ITRANSLATE procedure, we move the colorbar 350 pixels in the Y direction (vertically).

IIMAGE, FILEPATH('examples.tif', $
   SUBDIRECTORY=['examples', 'data']), /INSERT_COLORBAR

ITRANSLATE, 'bar', Y=350, /DEVICE

Rotating Items

Use the IROTATE procedure to change the orientation of a visualization or annotation in the X, Y, or Z plane.

For example, the following code creates an iSurface tool with some elevation data, then rotates the display by 30 degrees in the Z direction:

RESTORE, FILEPATH('marbells.dat', SUBDIRECTORY=['examples', 'data'])
ISURFACE, elev
IROTATE, 'surface', 30, /Z

Scaling Items

Use the ISCALE procedure to change the scale of data within a visualization. Scale factors are positive floating point numbers that correspond to a percentage increase or decrease in scale: a scale factor of 0.5 represents a reduction to 50% of the current size, and a scale factor of 2.0 means a doubling of the current size.

For example, the following code creates a plot of a sine wave, then scales the Y axis to be 50% of its original height:

IPLOT, SIN(2*!PI/100 * FINDGEN(100))

ISCALE, 'plot', Y = 0.5

Note
Text annotations cannot be scaled. You can, however, adjust the FONT_SIZE property of the text object using the ISETPROPERTY routine.

Magnifying the Window Contents

Use the IZOOM procedure to change the canvas zoom of the iTool window. Changing the canvas zoom changes the magnification of everything in the iTool window. (See Zooming for a discussion of different zooming techniques available in the iTools.)

Zoom factors are expressed as multiples of the current canvas zoom value. This means that if the canvas zoom is 100%, applying a zoom factor of 1.5 changes the zoom to 150%. Use the RESET keyword to the IZOOM procedure to return the canvas zoom value to 100% before applying the new zoom factor.

For example, the following code locates the minimum value in a plot, draws an ellipse around that point, and applies a zoom factor of 2.0 to the iTool window after resetting the canvas zoom to 100%.

values = RANDOMU(seed, 10)*10
IPLOT, values
minvalue = MIN(values, minindex)
IELLIPSE, 0.2, minindex, minvalue, /DATA, $
   COLOR=[255,0,0], TRANSPARENCY=50
IZOOM, 2.0, CENTER=[minindex, minvalue], /DATA, /RESET

The CENTER keyword specifies that the zoom should be centered on the specified point; that point will stay in its current location as the surrounding points move as a result of the change in magnification.