Skip to content

Commit 9c57820

Browse files
committed
a bit of documentation for axisX
1 parent c785d93 commit 9c57820

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,12 @@ Insets are specified in pixels. Corner radii are specified in either pixels or p
808808

809809
For marks that support the <a name="frameanchor">**frameAnchor**</a> option, it may be specified as one of the four sides (*top*, *right*, *bottom*, *left*), one of the four corners (*top-left*, *top-right*, *bottom-right*, *bottom-left*), or the *middle* of the frame.
810810

811+
The <a name="facetanchor">**facetAnchor**</a> option supports the following settings:
812+
* null - display the mark on each non-empty facet (default for all marks, with the exception of axis marks)
813+
* *top*, *right*, *bottom*, or *left* - display the mark on facets on the specified side
814+
* *top-empty*, *right-empty*, *bottom-empty*, or *left-empty* - display the mark on facets that have an empty space on the specified side (the empty space being either the margin, or an empty facet); this is the default for axis marks
815+
816+
811817
#### *mark*.plot(*options*)
812818

813819
Given a *mark*, such as the result of calling [Plot.barY](#plotbarydata-options), you can call *mark*.plot to render a plot. This is [shorthand](https://observablehq.com/@observablehq/plot-shorthand?collection=@observablehq/plot) for calling [Plot.plot](#plotplotoptions) where the *marks* option specifies this single mark.
@@ -973,16 +979,22 @@ When you need more control, you can add axis and grid marks explicitly in the ma
973979
<!-- jsdoc axisX -->
974980
975981
```js
976-
Plot.axisX(inequality, {x1: "POP_1980", y1: "R90_10_1980", x2: "POP_2015", y2: "R90_10_2015", bend: true})
982+
Plot.axisX({anchor: "bottom"})
977983
```
978984
979-
Returns a new axis with the given *data* and *options*.
985+
Returns a new axis with the given *data* and *options* for the *x* scale.
980986
981987
The optional *data* is an array of tick values—it defaults to the scale’s ticks.
982988
983-
The axis options described in [position options](#position-options) are all supported, except the **grid** option which is handled by the [grid](#grid) mark. The *axis* option, in this context, is called **anchor** and is one of *top* or *bottom*. The **color** option controls both **stroke** for the ticks, and the **fill** for labels.
989+
The axis options described in [position options](#position-options) are all supported, except the **grid** option which is handled by the [grid](#grid) mark. The **y** channel, if any, describes the vertical position of the tick and defaults to the axis anchor.
990+
991+
The **axis** option, in this context, is called **anchor** and is one of *top* or *bottom*.
992+
993+
The **color** option controls both **stroke** for the ticks, and the **fill** for labels. It defaults to currentColor.
994+
995+
The (rarely used) text label’s stroke is controlled by the **textStroke**,**textStrokeOpacity**, and **textStrokeWidth** options.
984996
985-
The **y** channel, if any, describes the vertical position of the tick. Defaults to the axis anchor.
997+
The **facetAnchor** option defaults to *bottom-empty* if anchor is bottom, and *top-empty* if anchor is top. This ensures the proper positioning of the axes with respect to empty facets.
986998
987999
<!-- jsdocEnd axisX -->
9881000

0 commit comments

Comments
 (0)