|AHELP for CIAO 4.9 ChIPS v1||
Changes the limits of one or more axes of the current plot.
limits([id,] dimension, min, max) limits([id,] dimension, object, objname) limits([id,] object, objname)
The function arguments.
|dimension||One of X_AXIS, Y_AXIS, or XY_AXIS to specify the X axis, Y axis, or both.|
|min||The minimum value for the axis range. A value of "AUTO" means that the minimum value of all the plotted objects (curve, histogram, contour and image) is used.|
|max||The maximum value for the axis range. A value of "AUTO" means that the maximum value of all the plotted objects (curve, histogram, contour and image) is used.|
|object||The type of the object to use for calculating the limits; one of chips_curve, chips_contour, chips_image, or chips_histogram.|
|objname||The name of the object, as a string.|
|id||A ChipsId structure identifying the item.|
The limits command sets the axes ranges for the x and/or y dimensions of the current plot. There are three ways to specify the limit values:
- user inputs the minimum and/or maximum values
- the keyword "AUTO" or string "auto" is used for the min and/or max, telling ChIPS to calculate that value based on the data
- set the limits to match a particular curve, contour, image or histogram that exists in the figure (this option is not available in the ChIPS GUI).
If the minimum value is greater than the maximum value, ChIPS automatically transposes them.
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.
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. Reenable 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.
If a data or plot aspect ratio is set (see "ahelp aspectratio" for more information) then the limits will be adjusted to ensure that the aspect-ratio constraint is retained.
The zoom(), panto(), and pick_limits() commands can also be used to change the limits of the plot.
chips> clear() chips> x = np.arange(0, 10, 0.1) chips> y = np.tan(x) chips> add_curve(x, y, ["symbol.style", "none"]) chips> get_plot_range() [-0.49500000000000005, 10.395, -39.979797520708914, 86.46002775262636] chips> limits(0, 10, -30, 90) chips> get_plot_range() [0.0, 10.0, -30.0, 90.0] chips> limits(X_AXIS, 4, 6) chips> get_plot_range() [4.0, 6.0, -30.0, 90.0] chips> limits(Y_AXIS, -20, 20) chips> get_plot_range() chips>[4.0, 6.0, -20.0, 20.0] chips> limits(XY_AXIS, AUTO, AUTO) chips> get_plot_range() [-0.49500000000000005, 10.395, -39.979797520708914, 86.46002775262636]
Here we create a simple plot - y=tan(x) - and then use the limits command to change the axis limits. First we change both x and y, then just the X axis, then the Y axis, and finally back to both axes. The use of AUTO in the limits call means to use the data range - here the curve - coupled with the axis pad factor to determine the limits.
chips> limits(XY_AXIS, AUTO, 100)
The command automatically calculates the minimum limit of the current x and y axes from the data. The maximum value of both axes is set to 100.
chips> split(2,1,0.1) chips> add_curve([1,7,9], [2,3,1]) chips> current_plot("plot2") chips> add_curve([5,10,15], [25,50,55]) chips> limits(X_AXIS, 5, 10) chips> current_plot("plot1") chips> limits(X_AXIS, 5, 10)
Create a pair of plots which each contain a curve. The x-axis limits are changed in the current plot - plot2 - to 5:10. Then plot1 is made current and the same x-axis limits are applied. Refer to the bind_axes command for an alternate method of matching axis attributes between plots.
chips> add_curve([40,50,60], [50,40,60], ["line.color", "red"]) chips> add_curve([50,60,70], [50,60,70], ["line.color", "gold"]) chips> limits(chips_curve, "crv1") chips> limits(Y_AXIS, chips_curve, "crv2")
Snap the limits of both axes to the range of curve "crv1" and then snap the y axis range to the range of curve "crv2"
chips> limits(X_AXIS, 4, 10) chips> set_axis(["automin", True, "automax", True]) chips> add_curve([-23,4,15], [10,8,11])
Set the X-axis limits of the current plot to run from 4 to 10. Then reenable the automin and automax properties of the axis. When the curve is added, the axis limits automatically adjust.
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.