Skip to content
mbostock edited this page Jun 7, 2011 · 13 revisions

Each example shows axes in four orientations. In clockwise order: top, right, bottom, left. Most commonly an x scale would be drawn with the bottom orientation, and a y scale would be drawn with the left orientation. For a scatterplot matrix, you might want to alternate orientations for the edge cells.

Examples

Open Domain

An open domain means that only ticks or grid lines are drawn:

axes-open-labels axes-open axes-open-major-labels

It is also possible to draw both ticks and grid lines. If the ticks are not drawn, then the labels are positioned closer to the grid lines.

Closed Domain

A closed domain means that we can visualize the domain extent. This can be done in by drawing a path:

axes-closed-labels axes-closed

Or by filling the background. In this case we include major and minor grid lines which subdivide the ticks:

axes-open-minor-labels

Note that the grid lines can also be drawn with an open domain, as above. And the background need not be filled—we could instead stroke the background to create a frame.

Sectional

Sometimes we want to label sections rather than points on the axes:

axes-open-region-labels axes-closed-region-labels

Settings

  • scale - the associated scale, either ordinal or quantitative
  • tickCount - the number of ticks to generate
  • tickFormat - the function to format labels. if null, hide labels?
  • tickGrid - major, minor, none
  • orient - top, right, bottom, left
  • domain - open, closed

Clone this wiki locally