Skip to content

Commit 202c95c

Browse files
committed
Merge branch 'main' of github.com:observablehq/plot into main
2 parents dc2be51 + 6691d2d commit 202c95c

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

README.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,11 +1132,11 @@ Groups on the first channel of *z*, *fill*, or *stroke*, if any. If none of *z*,
11321132

11331133
[<img src="./img/window.png" width="320" height="198" alt="moving averages of daily highs and lows">](https://observablehq.com/@data-workflows/plot-map)
11341134

1135-
[Source](./src/transforms/map.js) · [Examples](https://observablehq.com/@data-workflows/plot-map) · Groups data into series along the *z* dimension and then applies a mapping function to each series’ values, say to normalize them relative to some basis or to apply a moving average.
1135+
[Source](./src/transforms/map.js) · [Examples](https://observablehq.com/@data-workflows/plot-map) · Groups data into series and then applies a mapping function to each series’ values, say to normalize them relative to some basis or to apply a moving average.
11361136

1137-
The map transform derives new output channels from corresponding input channels. The output channels have strictly the same length as the input channels; the map transform does not affect the mark’s data or index. The map transform is similar to running [*array*.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on the input channel’s values with the given function; however, the map transform is series-aware: the data are first grouped into series along the *z* dimension in the same fashion as the [area](#area) and [line](#line) marks so that series can be processed independently. (You wouldn’t want a moving average to bleed between series, right?)
1137+
The map transform derives new output channels from corresponding input channels. The output channels have strictly the same length as the input channels; the map transform does not affect the mark’s data or index. The map transform is akin to running [*array*.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) on the input channel’s values with the given function. However, the map transform is series-aware: the data are first grouped into series using the *z*, *fill*, or *stroke* channel in the same fashion as the [area](#area) and [line](#line) marks so that series are processed independently.
11381138

1139-
Like the [group](#group) and [bin](#bin) transforms, the [Plot.map](#plotmapoutputs-options) transform takes two arguments: an *outputs* object that describes the output channels to compute, and an *options* object that describes the input channels and additional options to propagate. The other map transforms, such as [Plot.normalizeX](#plotnormalizexoptions) and [Plot.windowX](#plotwindowxoptions), call Plot.map internally.
1139+
Like the [group](#group) and [bin](#bin) transforms, the [Plot.map](#plotmapoutputs-options) transform takes two arguments: an *outputs* object that describes the output channels to compute, and an *options* object that describes the input channels and any additional options. The other map transforms, such as [Plot.normalizeX](#plotnormalizexoptions) and [Plot.windowX](#plotwindowxoptions), call Plot.map internally.
11401140

11411141
The following map methods are supported:
11421142

@@ -1234,54 +1234,40 @@ Like [Plot.mapY](#plotmapymap-options), but applies the window map method with t
12341234

12351235
[<img src="./img/select.png" width="320" height="198" alt="a line chart of several stocks">](https://observablehq.com/@data-workflows/plot-select)
12361236

1237-
[Source](./src/transforms/select.js) · [Examples](https://observablehq.com/@data-workflows/plot-select) · Selects one (or possibly several) values from a series, say to label a line or annotate extremes.
1237+
[Source](./src/transforms/select.js) · [Examples](https://observablehq.com/@data-workflows/plot-select) · Selects a value from each series, say to label a line or annotate extremes.
1238+
1239+
The select transform derives a filtered mark index; it does not affect the mark’s data or channels. It is similar to the basic [filter transform](#transforms) except that provides convenient shorthand for pulling a single value out of each series. The data are grouped into series using the *z*, *fill*, or *stroke* channel in the same fashion as the [area](#area) and [line](#line) marks.
12381240

12391241
#### Plot.selectFirst(*options*)
12401242

1241-
Selects the first point of the series, in input order.
1243+
Selects the first point of each series according to input order.
12421244

12431245
#### Plot.selectLast(*options*)
12441246

1245-
Selects the last point of the series, in input order.
1247+
Selects the last point of each series according to input order.
12461248

12471249
#### Plot.selectMinX(*options*)
12481250

1249-
Selects the left-most point of the series.
1251+
Selects the leftmost point of each series.
12501252

12511253
#### Plot.selectMinY(*options*)
12521254

1253-
Selects the lowest point of the series.
1255+
Selects the lowest point of each series.
12541256

12551257
#### Plot.selectMaxX(*options*)
12561258

1257-
Selects the right-most point of the series.
1259+
Selects the rightmost point of each series.
12581260

12591261
#### Plot.selectMaxY(*options*)
12601262

1261-
Selects the highest point of the series.
1263+
Selects the highest point of each series.
12621264

12631265
### Stack
12641266

12651267
[<img src="./img/stack.png" width="320" height="198" alt="a stacked area chart of revenue by category">](https://observablehq.com/@data-workflows/plot-stack)
12661268

12671269
[Source](./src/transforms/stack.js) · [Examples](https://observablehq.com/@data-workflows/plot-stack) · Arranges groups of data sharing a same location (*e.g.* **x**) into a pile, computing the starting and ending levels of each value in that pile, so that the starting level of an element is equal to the ending level of the element that precedes it in the pile. A channel (*e.g.* **y**) can be used to indicate the height of each element (defaults to 1).
12681270

1269-
#### Plot.stackY(_options_)
1270-
1271-
Creates new channels **y1** and **y2**, obtained by stacking the original **y** channel for data points that share a common **x** (and possibly **z**) value. A new **y** channel is also returned, which lazily computes the middle value of **y1** and **y2**. The input **y** channel defaults to a constant 1, resulting in a count of the data points.
1272-
1273-
The stacking options are detailed below.
1274-
1275-
#### Plot.stackY1(_options_)
1276-
1277-
Equivalent to [Plot.stackY](#plotstackyoptions), except that the **y1** channel is returned as the **y** channel. This can be used, for example, to draw a line at the bottom of each stacked area.
1278-
1279-
#### Plot.stackY2(_options_)
1280-
1281-
Equivalent to [Plot.stackY](#plotstackyoptions), except that the **y2** channel is returned as the **y** channel. This can be used, for example, to draw a line at the top of each stacked area.
1282-
1283-
#### Stack options
1284-
12851271
The supported stack options are:
12861272

12871273
- **order** - the order in which the data points are stacked
@@ -1312,15 +1298,27 @@ The following **offset** options are supported:
13121298

13131299
A new **y** channel is eventually returned, which lazily computes the middle value of **y1** and **y2**. It can be used to position a label or a dot in the middle of the corresponding interval.
13141300

1315-
#### Plot.stackX(_options_)
1301+
#### Plot.stackY(*options*)
1302+
1303+
Creates new channels **y1** and **y2**, obtained by stacking the original **y** channel for data points that share a common **x** (and possibly **z**) value. A new **y** channel is also returned, which lazily computes the middle value of **y1** and **y2**. The input **y** channel defaults to a constant 1, resulting in a count of the data points.
1304+
1305+
#### Plot.stackY1(*options*)
1306+
1307+
Equivalent to [Plot.stackY](#plotstackyoptions), except that the **y1** channel is returned as the **y** channel. This can be used, for example, to draw a line at the bottom of each stacked area.
1308+
1309+
#### Plot.stackY2(*options*)
1310+
1311+
Equivalent to [Plot.stackY](#plotstackyoptions), except that the **y2** channel is returned as the **y** channel. This can be used, for example, to draw a line at the top of each stacked area.
1312+
1313+
#### Plot.stackX(*options*)
13161314

13171315
See Plot.stackY, but with *x* as the input value channel, *y* as the stack index, *x1*, *x2* and *x* as the output channels.
13181316

1319-
#### Plot.stackX1(_options_)
1317+
#### Plot.stackX1(*options*)
13201318

13211319
Equivalent to [Plot.stackX](#plotstackxoptions), except that the **x1** channel is returned as the **x** channel. This can be used, for example, to draw a line at the left edge of each stacked area.
13221320

1323-
#### Plot.stackX2(_options_)
1321+
#### Plot.stackX2(*options*)
13241322

13251323
Equivalent to [Plot.stackX](#plotstackxoptions), except that the **x2** channel is returned as the **x** channel. This can be used, for example, to draw a line at the right edge of each stacked area.
13261324

0 commit comments

Comments
 (0)