|AHELP for CIAO 4.5 ChIPS v1||
Change the position and labels for the major tickmarks on an axis
set_arbitrary_tick_positions(pos) set_arbitrary_tick_positions(pos, labels) set_arbitrary_tick_positions(id, pos) set_arbitrary_tick_positions(id, pos, labels)
- id - an optional ChipsId structure containing values to modify the currency state for the command. In lieu of a ChipsId object, the string id of an axis such as 'ax1' may be passed in.
- pos - an array containing the data coordinate values when majortick marks should be displayed.
- labels - an array of labels to use at the majortick locations specified in array pos. If provided, this array must contain the same numer of elements as pos. Any element that is not a string is converted using the str() method.
The set_arbitrary_tick_positions command specifies the location of major tickmarks when the majortick mode is set to "arbitrary". Additionally, the call may be used to specify string labels instead of numeric labels.
By default, set_arbitrary_tick_positions operates on the current x and y axes. If the user specifies a specific axis, either via a ChipsId object or an axis label string, only the specified axis is modified. The call does two things:
- it changes the default tick locations to use when the majortick mode is set to arbtitrary, and
- it sets the majortick mode to arbitrary.
The limits are not adjusted by this call; only tick locations within the limits of the displayed axis range appear on the screen. If the user adjusts the limits, the arbitrary positions within the limits are displayed. Note that when displaying arbitrary ticks, no tick marks (major or minor) will appear outside of the range of provided abritrary locations. For instance, if set_arbitrary_tick_positions is called with values [5,10,15,20] but the axis data limits run from 7 to 40, then there will be no ticks from 20 to 40.
The display of tickmarks on axes is controlled by the tick mode of the axis. If the mode is set to 'arbitrary', tick marks will only be displayed in the range of set arbitrary tick positions. Data limits do not adjust during a change in tick mode.
In addition to allowing the user to specify the locations of tick marks, this command is also used to allow the user to set alpha-numeric labels. To use text for tick mark labels, two arrays are supplied to this routine. The first array contains the locations of where the major tick marks should be placed. The second array contains the strings to use at each tick mark location. The two arrays must contain the same number of elements. To have a tickmark without a corresponding label, an empty string is used in the second array (ie. "").
chips> x = [1,2,3,4,5,6,7] chips> xl = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] chips> y = [3,2,1,4,0,1,2] chips> add_histogram(y, ["dropline", True, "fill.style", "downdiagonal"]) chips> set_arbitrary_tick_positions("ax1", x, xl) chips> set_xaxis("ax1", ["minortick.visible", False])
Creates a histogram with seven bins and then changes the X axis major tick labels to be strings specifying days of the week and hide the minor tick marks.
chips> clear() chips> add_contour([4,9,3,2], 2, 2, ["axis.minortick.visible", False]) chips> set_arbitrary_tick_positions([1.13,1.47,1.73,1.81,2.04])
Here we create a contour plot and then adjust the ticks on both axes to appear at the values 1.13, 1.47, 1.73 and 1.81. Since the image covers the axis range 1 to 2 the final value, at 2.04, is not shown unless the limits are increased:
chips> limits(X_AXIS, 0.8, 2.2)
This changes both axes since the creation of a contour plot forced the plot to have its data-aspect ratio set.
For more information on aspect ratios, refer to "ahelp aspectratio".
chips> x = np.arange(5) chips> y = x**3 chips> add_curve(x, y, ["symbol.style", "none"]) chips> log_scale(Y_AXIS) chips> yl = [1, 2, 5, 10, 20, 50] chips> set_arbitrary_tick_positions("ay1", yl) chips> set_yaxis(["minortick.visible", False])
Here we add labels to a log-scale axis, turning off the minor tick marks since they are not informative.
chips> p = [10.23, 47.5, 89.8, 102.3] chips> l = [1, "2", None, "last"] chips> set_arbitrary_tick_positions("ax1", p, l)
In this very-contrived example, we add labels at x = 10.23, 47.5, 89.8 and 102.3. The labels for these are converted to strings from the input values, so will be displayed as: "1", "2", "None" and "last" (without the quotation marks). The following command would create the same result:
chips> set_arbitrary_tick_positions("ax1", p, [str(ll) for l in l])
The positions and labels set by a call to set_arbitrary_tick_positions() are now displayed in the 'Manual Ticks' section. This widget has been improved to make it easier to change, add, or delete major tick positions and labels.
In CIAO 4.4, if the first tick position was given an empty label - i.e. set to "" - then the axis would not display correctly. This has been fixed in CIAO 4.5.
Axes for which arbitrary tick positions have been set were not displayed correctly if they were then bound to another axis using the bind_axes command in CIAO 4.4. This has been fixed in CIAO 4.5.
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.
- add_axis, bind_axes, current_axis, delete_axis, display_axis, display_major_ticks, display_minor_ticks, get_axis, get_xaxis, get_yaxis, hide_axis, hide_major_ticks, hide_minor_ticks, lin_scale, log_scale, move_axis, reverse_axes, set_axis, set_xaxis, set_yaxis, shuffle_axis, unbind_axes