You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-29Lines changed: 27 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1132,11 +1132,11 @@ Groups on the first channel of *z*, *fill*, or *stroke*, if any. If none of *z*,
1132
1132
1133
1133
[<imgsrc="./img/window.png"width="320"height="198"alt="moving averages of daily highs and lows">](https://observablehq.com/@data-workflows/plot-map)
1134
1134
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.
1136
1136
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.
1138
1138
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.
1140
1140
1141
1141
The following map methods are supported:
1142
1142
@@ -1234,54 +1234,40 @@ Like [Plot.mapY](#plotmapymap-options), but applies the window map method with t
1234
1234
1235
1235
[<imgsrc="./img/select.png"width="320"height="198"alt="a line chart of several stocks">](https://observablehq.com/@data-workflows/plot-select)
1236
1236
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.
1238
1240
1239
1241
#### Plot.selectFirst(*options*)
1240
1242
1241
-
Selects the first point of the series, in input order.
1243
+
Selects the first point of each series according to input order.
1242
1244
1243
1245
#### Plot.selectLast(*options*)
1244
1246
1245
-
Selects the last point of the series, in input order.
1247
+
Selects the last point of each series according to input order.
1246
1248
1247
1249
#### Plot.selectMinX(*options*)
1248
1250
1249
-
Selects the left-most point of the series.
1251
+
Selects the leftmost point of each series.
1250
1252
1251
1253
#### Plot.selectMinY(*options*)
1252
1254
1253
-
Selects the lowest point of the series.
1255
+
Selects the lowest point of each series.
1254
1256
1255
1257
#### Plot.selectMaxX(*options*)
1256
1258
1257
-
Selects the right-most point of the series.
1259
+
Selects the rightmost point of each series.
1258
1260
1259
1261
#### Plot.selectMaxY(*options*)
1260
1262
1261
-
Selects the highest point of the series.
1263
+
Selects the highest point of each series.
1262
1264
1263
1265
### Stack
1264
1266
1265
1267
[<imgsrc="./img/stack.png"width="320"height="198"alt="a stacked area chart of revenue by category">](https://observablehq.com/@data-workflows/plot-stack)
1266
1268
1267
1269
[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).
1268
1270
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
-
1285
1271
The supported stack options are:
1286
1272
1287
1273
-**order** - the order in which the data points are stacked
@@ -1312,15 +1298,27 @@ The following **offset** options are supported:
1312
1298
1313
1299
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.
1314
1300
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*)
1316
1314
1317
1315
See Plot.stackY, but with *x* as the input value channel, *y* as the stack index, *x1*, *x2* and *x* as the output channels.
1318
1316
1319
-
#### Plot.stackX1(_options_)
1317
+
#### Plot.stackX1(*options*)
1320
1318
1321
1319
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.
1322
1320
1323
-
#### Plot.stackX2(_options_)
1321
+
#### Plot.stackX2(*options*)
1324
1322
1325
1323
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.
0 commit comments