Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: December 2012

URL: http://cxc.harvard.edu/chips/swap_object_positions.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.5 ChIPS v1

swap_object_positions

Context: plots

Synopsis

Swaps the locations of the specified plots within a grid or split.

Syntax

swap_object_positions(id, plot_id)

Description

  • id - required ChipsId structure specifying the first plot id. It may also contain values specify the window and frame on which to operate.
  • plot_id - the second plot id to use in the swap.

The swap_object_positions command swaps the locations of two plots within a grid or split. The two plots must be in the same frame and must have been created with the split or grid_objects commands.

The id of the first plot is specified in the ChipsId field. Unlike most commands, the ChipsId is not optional. If the window and frame fields of the ChipsId structure are not specified, currency is used to determine which to use. The plot id of the structure must be specified.

The second argument is a string containing the plot id of the other plot. If either plot id is blank, an error is returned.

The swapped positions are not static. Subsequent calls to split or grid_objects do not take the swapped positions into account.

When the two plots are swapped, the drawing areas of the plots do not change, i.e. the normalized coordinates of the plots are static. This is illustrated in Example 2, below.

Example 1

chips> split()
chips> add_curve([1,2,3],[4,5,6])
chips> current_plot('plot2')
chips> add_curve([7,8,9],[6,5,4])
chips> id=ChipsId()
chips> id.plot='plot1'
chips> swap_object_positions(id,'plot2')

A split command creates a pair of vertically stacked plot areas. A curve is added to each plot area. The swap_object_positions command is then called to switch the locations of the two plot areas.

Example 2

chips> add_frame()
chips> grid_objects(3,2,.05,.05,1)
chips> adjust_grid_xrelsize(2,2)
chips> add_contour([1,2,4,0,5,6],3,2)
chips> current_plot('plot5')
chips> add_contour([2,0,3,4,2,2],3,2)
chips> id=ChipsId()
chips> id.plot='plot1'
chips> swap_object_positions(id,'plot5')

A grid_objects command is called to create a grid of 6 plot areas. The width of the middle column of plots is doubled using adjust_grid_xrelsize. Contours are added to the first and fifth plot areas. The swap_object_positions command is then used to switch the locations of the two plot areas. Note that the drawing areas are not rescaled by the swap_object_positions command; the normalized coordinates of the plots are static.

Bugs

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

See Also

limits
get_plot_range
plots
add_plot, adjust_grid_gaps, adjust_grid_xrelsize, adjust_grid_xrelsizes, adjust_grid_yrelsize, adjust_grid_yrelsizes, clear_plot, current_plot, delete_plot, display_plot, get_plot, grid_objects, hide_plot, move_plot, reposition_plot, set_data_aspect_ratio, set_plot, set_plot_aspect_ratio, split, strip_chart

Last modified: December 2012
CXC logo

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2012. All rights reserved.