next up previous contents index
Next: Coordinate Grids Up: High-Level Picture Elements Previous: Arrows   Contents   Index

Coordinate Axes and Labels

A coordinate axis consists of a line between two points together with a specified number of regularly-spaced tick marks:

  h_axis(p1, p2, n);    // n subintervals (n+1 ticks)
  v_axis(p1, p2, n);
The style of tick mark is appropriate for an axis of the given type. If the endpoints are omitted, they default to $ p_1=(x_\mathrm{min},0)$ and $ p_2=(x_\mathrm{max},0)$ for a horizontal axis, or to $ p_1=(0,y_\mathrm{min})$ and $ p_2=(0,y_\mathrm{max})$ for a vertical axis. If the bounding box has integer width and/or height, then omitting the number of points draws tick marks one unit apart.

Labels for a horizontal axis are generated with:

  h_axis_labels(P p1, P p2, int n, P offset, [alignment]);
This puts $ (n+1)$ evenly-spaced labels on the segment joining p1 and p2. The labels are automatically generated to match their horizontal location. As for ordinary labels, the offset is in pt, and the optional LATEX-style alignment option places the labels using their corners rather than their reference points. Labels for a vertical axis are generated in the obvious way.

As for coordinate axes, the initial and final points may be omitted in an axis_label command, with the same defaults. However, the offset and number of labels must always be specified.


next up previous contents index
Next: Coordinate Grids Up: High-Level Picture Elements Previous: Arrows   Contents   Index
Andrew D. Hwang 2004-09-04