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

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


AHELP for CIAO 4.9 ChIPS v1

pick_limits

Context: limits

Synopsis

Interactively change the limits of a plot using the mouse.

Syntax

pick_limits()
pick_limits(dimension)
pick_limits(id)
pick_limits(id, dimension)

Description

The function arguments.

Argument Description
dimension One of X_AXIS, Y_AXIS, or XY_AXIS to specify the X axis, Y axis, or both.
id A ChipsId structure identifying the item.

The pick_limits command allows the user to interactively set the axes ranges for the x and/or y dimensions of a plot. After issuing the command, the user left-clicks on the plot and drags to draw a bounding box (i.e. keeps the mouse button pressed down). When the mouse button is released, the plot axes limits are filtered to match the x and/or y ranges contained within the box, and the command finishes.

This functionality is also usable directly from the ChIPS window by selecting the Range mode either from the right-mouse-button menu or in the ChIPS GUI.

Bringing up the GUI

The GUI can be launched by right clicking on an existing ChIPS window and selecting "Show GUI", or by running the show_gui command from the ChIPS command line.

Related commands

The zoom(), panto(), and limits() commands can also be used to change the limits of the plot.

How do I cancel a selection

Hitting the Escape key before releasing the mouse button (or before making the initial mouse press) will exit the routine without changing the limits. If the new limits are not satisfactory then the undo command can be used to restore the previous ranges.

Changing the box color

The bounding box color may be specified by setting the pick.color preference; the default is gold. This preference is loaded when a window is created, so changing the value will impact subsequent windows but not any existing ones.

What limits get changed?

When the limits of an axis are changed, any axes that are bound to that axis are also changed, including plot border axes; see "ahelp bind_axes" for more information. The automin and automax properties of the modified axis are disabled as well when it is altered by a limits command. Re-enable the automin and automax properties of the axis so that it will automatically rescale when new objects are added; see "ahelp set_axis" for more information.

What happens when the plot has a data-aspect ratio?

If the plot contains a data-aspect ratio, then the rectangle created by pick_limits() will contain two parts: the dashed line shows the current range selected by the user while the solid rectangle shows that part of the user-selected area that matches the given aspect ratio.

Example 1

chips> x = np.arange(0,10,0.1)
chips> y = np.tan(x)
chips> add_curve(x, y, ["symbol.style", "none"])
chips> pick_limits()

When the pick_limits routine is called, move into the ChIPS plot window and press down (and hold) the left-mouse button. Dragging the mouse will create a gold-colored box, which indicates what range will be used for both axes. Letting go of the mouse button will zoom the plot to this range; hitting the Escape key whilst the button is still pressed will cancel the call.

Since no arguments are sent to pick_limits, this call will change the limits of both the X and Y axes of the current plot. If the resulting limits are not what you want, you can use the undo call to restore the previous limits, call pick_limits again, or use the limits command.

Example 2

chips> add_image("img.fits")
chips> print(get_data_aspect_ratio())
1:1
chips> pick_limits()

Since the image has set the data-aspect ratio, the pick_limits call will restrict the selected range so that the ratio is retained.

Example 3

chips> pick_limits(Y_AXIS)

Only the Y axis range will be changed by this call.

Example 4

chips> id = ChipsId()
chips> id.plot = "plot1"
chips> pick_limits(id, X_AXIS)

Here we change the X-axis limits of the plot called "plot1". This is similar to

chips> current_plot("plot1")
chips> pick_limits(X_AXIS)

except that the latter requires a call of "undo(2)" to revert.

Bugs

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

See Also

contrib
chips_utils
limits
limits, panto, zoom

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.