About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2008

URL: http://cxc.harvard.edu/chips4.1/pick_limits.py.html
AHELP for ChIPS 4.1

pick_limits

Context: py.chips

Synopsis

Interactively change the limits of a plot using the mouse.

Syntax

pick_limits([ChipsId,] [dimension])

Description

  • ChipsId - an optional ChipsId structure containing values to modify the currency state for the command.
  • dimension - operate on axis in X dimension (X_AXIS), Y dimension (Y_AXIS), or both (default, XY_AXIS).

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. When the routine is running the title of the ChIPS window may display the coordinates of the cursor (this depends on the window manager being used).

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.

Example 1

chips> x = numpy.arange(0,10,0.1)
chips> y = numpy.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> pick_limits(Y_AXIS)

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

Example 3

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

Do not use when the window display is turned off

It is possible to hang ChIPS if you use pick_limits with a window which was created with its display attribute set to False and this attribute has remained unchanged.

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

Last modified: December 2008



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-2004. All rights reserved.