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

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


AHELP for CIAO 4.9 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)

Description

The function arguments.

Argument Description
id A ChipsId structure specifying the first plot to be moved; if the frame and window fields are not set then the current values are used.
plot The name of the second plot to use. It must have the same frame and window as the first plot.

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, as can be seen by the plot margins reported by the info command:

chips> print(info())
Window [win1]
  Frame [frm1]
    Plot [plot1]   (0.15,0.15)  .. (0.90,0.52)
      Border bottom [bx1]  top [bx2]  left [by1]  right [by2]
      Curve [crv1]
      X Axis [ax1]
      Y Axis [ay1]
    Plot [plot2]   (0.15,0.52)  .. (0.90,0.90)
      Border bottom [bx1]  top [bx2]  left [by1]  right [by2]
      Curve [crv1]
      X Axis [ax1]
      Y Axis [ay1]

Example 2

chips> add_frame()
chips> grid_objects(3, 2, 0.05, 0.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, ['color', 'red'])
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 2013
Smithsonian Institute Smithsonian Institute

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