Skip to content

Commit 427c593

Browse files
committed
docs: clarify explicit grid tick values
1 parent 356f579 commit 427c593

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

docs/marks/grid.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,24 @@ See the [axis mark](./axis.md) for more details and examples.
6161

6262
## Grid options
6363

64-
The optional *data* is an array of tick values — it defaults to the scale’s ticks. The grid mark draws a line for each tick value, across the whole frame.
64+
The optional *data* is an array of tick values; if omitted, the mark computes its own ticks from the corresponding scale. To use the scale’s **ticks** option, use an implicit grid by setting the scale’s **grid** option, or pass the tick values directly to an explicit grid mark.
65+
66+
For example, to align a grid with explicit tick values, pass the values to both the axis and grid marks:
67+
68+
:::plot
69+
```js
70+
Plot.plot({
71+
x: {
72+
domain: [new Date(2026, 2, 9), new Date(2026, 2, 11)]
73+
},
74+
marks: [
75+
((ticks) => [Plot.gridX(ticks), Plot.axisX(ticks)])(
76+
["2026-03-09", "2026-03-10", "2026-03-11"].map((d) => new Date(d))
77+
)
78+
]
79+
})
80+
```
81+
:::
6582

6683
The following options are supported:
6784

0 commit comments

Comments
 (0)