Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/chips/ahelp/move_label.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.11 ChIPS v1

move_label

Context: labels

Synopsis

Moves the label to a new location.

Syntax

move_label(xval, yval)
move_label(xval, yval, mode)
move_label(id, xval, yval)
move_label(id, xval, yval, mode)

Description

The function arguments.

Argument Description
xval, yval The x and y coordinates to move. The mode parameter determines whether these are relative or absolute. Unless explicitly specified by the coord_sys field of the optional ChipsId argument, the coordinate system used to create the object is used.
mode The position is in absolute coordinates (mode=0) or relative (mode=1). The default is absolute.
id A ChipsId structure identifying the item.

The move_label command moves the label to a new position. The new location may be specified as an absolute position (default) or as relative offsets from the original location.

The following coordinate systems may be used to move a label: PIXEL, WINDOW_NORM, FRAME_NORM, PLOT_NORM, or DATA. The system is specified by setting the coord_sys field of the optional ChipsId structure which may be passed into the move_label routine. If a ChipsId is not provided, the default coordinate system of the label is used.

When a label is moved, it remains in its original coordinate system regardless of what coordinate system was used for the move. The move command translates the specified values to the coordinate system that the label is in before applying them to the label. This means that labels that are originally placed in normalized coordinates and get relocated using data coordinates will not be clipped if they land outside the visible data range. Conversely, labels in data coordinates which are moved using normalized coordinates to beyond the plot area will be clipped.

This command is equivalent to calling the move command with 'chips_label' specified as the object.


Examples

Example 1

chips> move_label(.5,.5)

Move the current label to (0.5, 0.5) in the coordinate system used to create it.

Example 2

chips> clear()
chips> add_curve([1,2,3], [4,5,6])
chips> add_label(0.05, 0.9, 'A Label', ['coordsys', PLOT_NORM])
chips> move_label(0.8, 0.1)

The label is created in the top-left corner of the plot, then moved so that it is in the bottom-right corner.

Example 3

chips> id = ChipsId()
chips> id.coord_sys = PIXEL
chips> move_label(id, -20, 0, 1)

For a label specified in data coordinates, adjust the position by 20 pixels to the left in the x direction. Do not move it in the y direction.

Example 4

chips> id = ChipsId()
chips> id.label = 'all'
chips> id.coord_sys = DATA
chips> move_label(id, 40, 10, 1)

Shift all labels by the same distance in data coordinates.


Bugs

See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.

See Also

labels
add_label, current_label, delete_label, display_label, get_label, hide_label, set_label, shuffle_label
utilities
load_font