Synopsis
Link two axes so that changes in the range, scale or other attributes in one will be automatically copied to the other.
Syntax
bind_axes(ax_primary, ax_secondary) bind_axes(pl_primary, ax_primary, pl_secondary, ax_secondary) bind_axes(id, pl_secondary, ax_secondary)
Description
The function arguments.
Argument | Description |
---|---|
ax_primary | The name of the axis whose values will be maintained after the bind. |
ax_secondary | The name of the axis whose values will be changed after the bind. |
pl_primary | The name of the plot which contains the ax_primary axis. |
pl_secondary | The name of the plot which contains the ax_secondary axis. |
id | A ChipsId structure specifying the primary plot and axis name. |
The bind_axes command allows a user to synchronize the limits, scale, and other properties of a pair of axes either within a single plot or in different plots within a single frame. This means that when the limits, scale, or tick mode of an axis changes, any axes bound to the modified axis are also changed. The axes do not need to be in the same dimension - an x axis can be bound to a y axis.
Once bound, changes to either axis will be automatically reflected in the other axis. An axis can be bound to more than one axis; in this case the properties are synchronized across all the bound axes.
Examples
Example 1
chips> erase() chips> add_curve([14,23,53,71], [6,81,24,96]) chips> add_axis(Y_AXIS, 60, 1, 10) chips> bind_axes("ay1", "ay2") chips> log_scale(Y_AXIS)
Create a plot which has an extra Y axis at x=60. The sexond Y axis is bound to the first so that changes to the limits, or scale, of one - such as the log_scale call - will change both simultaneously.
Example 2
chips> clear() 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> bind_axes("plot2","ax1","plot1","ax1")
Create a pair of plots which each contain a curve. Bind the x axes of the two plots to cover the range of the curve in the lower plot ("plot2").
The strip_chart command will create a set of vertically-aligned plots with bound X axes.
Example 3
chips> add_curve([14,23,53,71], [6,81,24,96]) chips> log_scale(Y_AXIS) chips> id = ChipsId() chips> id.axis = "ay1" chips> bind_axes(id, "plot1", "ax1")
Bind the x axis of a plot to its y axis, using a ChipsId structure to specify the primary axis.
Synchronized Properties
Bound axes are intended to display the same range of data. The following attributes are synchronized between bound axes: automin, automax, majortick.mode, majortick.interval, majortick.count, minortick.mode, minortick.interval, minortick.count, pad, and tickformat. In addition, internally-managed values such as data ranges are also synchronized by the bind command.
Properties that are aesthetic in nature are not synchronized during the bind, such as colors, tick lengths, tick styles, grid styles, and tick label fonts.
Notes
What axes are bound together?
The info_bound_axes command is used to display the list of currently bound axes.
Border Axes
Border axes of plots are implicitly bound to the first set of axes that are created. They may be unbound using the unbind_axes command.
Related commands
The strip_chart command creates a column or row of plots where the common axes are bound together; it can be considered to be a combination of split and multiple bind_axes calls.
Bugs
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.
See Also
- axes
- add_axis, 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_arbitrary_tick_positions, set_axis, set_xaxis, set_yaxis, shuffle_axis, unbind_axes