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
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1132,19 +1132,19 @@ 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 the values for each series, 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 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.
1136
1136
1137
-
The map transform derives new output channels from corresponding input channels. The output channels have 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 is first grouped into series along the *z* dimension in the same fashion as the [area](#area) and [line](#line) marks so that series are processed independently. (You wouldn’t want a moving average to bleed between series, would you?)
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?)
1138
1138
1139
-
Like the [group](#group) and [bin](#bin) transforms, the base [Plot.map](#plotmapoutputs-options) 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 additional options to propagate. 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
1143
1143
**cumsum* - a cumulative sum
1144
1144
* a function to be passed an array of values, returning new values
1145
1145
* an object that implements the *map* method
1146
1146
1147
-
The *map* method is repeatedly passed the index for each series (an array of integers), the corresponding input channel’s array of values, and the output channel’s array of values; it must populate the slots specified by the index in the output array.
1147
+
If a function is used, it must return an array of the same length as the given input. If a *map* method is used, it is repeatedly passed the index for each series (an array of integers), the corresponding input channel’s array of values, and the output channel’s array of values; it must populate the slots specified by the index in the output array.
1148
1148
1149
1149
The Plot.normalizeX and Plot.normalizeY transforms take an additional **basis** option which specifies how to normalize the series values. The following normalization methods are supported:
0 commit comments