Skip to content

Commit f76a68f

Browse files
committed
Update README
1 parent afed24b commit f76a68f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,38 @@ Plot.vector(wind, {x: "longitude", y: "latitude", length: "speed", rotate: "dire
12201220

12211221
Returns a new vector with the given *data* and *options*. If neither the **x** nor **y** options are specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
12221222

1223+
## Interactions
1224+
1225+
Interactions are special marks that handle user input and define interactive selections. When a plot has an interaction mark, the returned *plot*.value represents the current selection, which is an array representing the subset of the interaction mark’s data. As the user interacts with the plot and modifies the selection, *input* events are emitted. This is designed to work with [Observable’s viewof operator](https://observablehq.com/@observablehq/introduction-to-views), but you can also listen to *input* events directly using the [EventTarget interface](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget).
1226+
1227+
### Brush
1228+
1229+
[Source](./src/marks/brush.js) · [Examples](https://observablehq.com/@observablehq/plot-brush) · Selects points within a single contiguous rectangular region, such as nearby dots in a scatterplot.
1230+
1231+
#### Plot.brush(*data*, *options*)
1232+
1233+
```js
1234+
Plot.brush(penguins, {x: "culmen_depth_mm", y: "culmen_length_mm"})
1235+
```
1236+
1237+
Returns a new brush with the given *data* and *options*. If neither the **x** nor **y** options are specified, *data* is assumed to be an array of pairs [[*x₀*, *y₀*], [*x₁*, *y₁*], [*x₂*, *y₂*], …] such that **x** = [*x₀*, *x₁*, *x₂*, …] and **y** = [*y₀*, *y₁*, *y₂*, …].
1238+
1239+
#### Plot.brushX(*data*, *options*)
1240+
1241+
```js
1242+
Plot.brushX(penguins, {x: "culmen_depth_mm"})
1243+
```
1244+
1245+
Equivalent to [Plot.brush](#plotbrushdata-options) except that if the **x** option is not specified, it defaults to the identity function and assumes that *data* = [*x₀*, *x₁*, *x₂*, …].
1246+
1247+
#### Plot.brushY(*data*, *options*)
1248+
1249+
```js
1250+
Plot.brushY(penguins, {y: "culmen_length_mm"})
1251+
```
1252+
1253+
Equivalent to [Plot.brush](#plotbrushdata-options) except that if the **y** option is not specified, it defaults to the identity function and assumes that *data* = [*y₀*, *y₁*, *y₂*, …].
1254+
12231255
## Decorations
12241256

12251257
Decorations are static marks that do not represent data. Currently this includes only [Plot.frame](#frame), although internally Plot’s axes are implemented as decorations and may in the future be exposed here for more flexible configuration.

0 commit comments

Comments
 (0)