Last modified: December 2013

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


AHELP for CIAO 4.11 ChIPS v1

move_axis

Context: axes

Synopsis

Moves the axis to a new location.

Syntax

move_axis(xval, yval)
move_axis(xval, yval, mode)
move_axis(id, xval, yval)
move_axis(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_axis command moves the axis to a new position. The new location may be specified as an absolute position (default) or as relative offsets from the original location. If both an x and y axis are current, both will be moved by the command.

Note that the xval argument is ignored for X axes, and yval for Y axes since they can only be shifter vertically or horizontally respectively.

The following coordinate systems may be used to move an axis: 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_axis routine. If a ChipsId is not provided, the default coordinate system of the axis is used.

When an axis 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 axis is in before applying them to the axis. This means that axes 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, axes 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_axis' specified as the object.


Examples

Example 1

chips> move_axis(0.5, 0.5)

Since axes are plaxed in plot-normalized coordinates, this moves both the current X and Y axis to the center of the plot.

Example 2

chips> id = ChipsId()
chips> id.axis = 'ax1'
chips> move_axis(id, 0, 1)

Moves the current X axis to the top of the plot.

Example 3

chips> id=ChipsId()
chips> id.coord_sys = FRAME_NORM
chips> move_axis(id, 0.2, 0.4, 1)

For an axis specified in plot normalized coordinates, adjust the x-axis position by a fifth of the frame width (0.2) and the y-axis by two fifths of the frame height (0.4).

Example 4

chips> add_axis(XY_AXIS, 0, -10, 10)
chips> add_axis(X_AXIS, -6, -1000, 1000)
chips> id = ChipsId()
chips> id.coord_sys = DATA
chips> id.coord = 'plot1_ax1ay1'
chips> id.axis = 'ax2'
chips> move_axis(id, 0, 6)

Create a plot area with axes ranging from -10 to 10 in x and y. A second x axis is added at y = -6 in data coordinates. The move command repositions the second x axis to positive 6 in the data coordinates of the first axes.


Bugs

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

See Also

axes
add_axis, bind_axes, current_axis, delete_axis, display_axis, display_major_ticks, display_minor_ticks, get_axis, get_xaxis, get_yaxis, hide_axis, hide_major_ticks, hide_minor_ticks, lin_scale, log_scale, reverse_axes, set_arbitrary_tick_positions, set_axis, set_xaxis, set_yaxis, shuffle_axis, unbind_axes