How do I change the limits of an axis?
The limits command is used to change the range displayed by one or both axes. It can be used to select the minimum values that will include all the data (the AUTO setting) or explicit values can be given. Examples of its use are:
chips> clear() chips> add_curve([0.5, 1.5, 3], [1, 2, 3]) chips> add_curve([8, 9, 15], [12, 15, 8]) chips> set_axis(["pad", 0]) chips> limits(X_AXIS, 1, 10) chips> limits(X_AXIS, AUTO, AUTO) chips> limits(X_AXIS, 1, AUTO)
which will change the current X axis to display the range 1 to 10, the range covered by the data in the plot (so 9,5 to 15), and have a minimum of one with the maximum set to the data maximum (here 15). The set_axis call was used to ensure that no padding was added to the limits when the AUTO setting was used.
The option Y_AXIS is used to set the Y axis and XY_AXIS will change both axes at once, so
chips> limits(XY_AXIS, AUTO, AUTO)
is a simple way to make sure that all the data is visible in a plot.
What about axes drawn using a log scale?
When an axis is drawn using a logarithmic scale, limit values do not have to be changed (so you would still use 100 rather than 2). Limit values that are 0 or negative are ignored and replaced by the minimum (or maximum) positive data value for the axis.
The AUTO setting
This setting makes it easy to make sure the plot limits cover all the data but they do not take into account the range of the other axis; so after
chips> clear() chips> add_curve([1,5,10], [100, 50, 10]) chips> limits(XY_AXIS, 4, 11) chips> get_plot_yrange() [4.0, 11.0] chips> limits(Y_AXIS, AUTO, AUTO) chips> get_plot_yrange() [5.5, 104.5]
the Y range is set to match the full dataset rather than just the part displayed by the X-axis limits.
The majortick.mode setting
The previous discussion has been for when the majortick.mode attribute of the axis is set to "limits", which is the default value. If set to "nice" then the displayed limits are modified so that a sensible number of major tick marks are displayed and that the axis starts and ends at a major tick mark.
Selecting the axis range of a single object
The limits command can be used to select the axis ranges for a given object (curve, contour, histogram or image). For example, the following command sets the X and Y axes to match the data range of the curve with the label "crv2".
chips> limits(chips_curve, "crv2")
The ChIPS GUI
The ChIPS GUI makes it easy to modify a visualization using your mouse, rather than Python functions. The GUI can also be used to add annotations - such as labels, lines, points and regions - and to zoom or pan into plots.