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
TODO Describe output aggregation. Supported reducers:
1023
-
1024
-
**first* -
1025
-
**last* -
1026
-
**count* -
1027
-
**sum* -
1028
-
**proportion* -
1029
-
**proportion-facet* -
1030
-
**deviation* -
1031
-
**min* -
1032
-
**max* -
1033
-
**mean* -
1034
-
**median* -
1035
-
**variance* -
1022
+
The group transforms take two arguments: *outputs* and *inputs*. The input data is grouped on one or several input channels (for example on *x*), and a new data array is created for each group. Each property set in the *outputs* object creates an aggregation channel, that receives as input the groups, and reduces them to a value for each group. A value channel is defined for each aggregation channel, for example *y* when grouping on *x*.
1023
+
1024
+
Supported reducers:
1025
+
1026
+
**first* - first element of the group, in input order
1027
+
**last* - last element of the group, in input order
1028
+
**count* - number of elements in the group
1029
+
**sum* - sum of the values of the elements in the group; defaults to* the *count* if the value channel is not defined
1030
+
**proportion* - *sum* of the group divided by the total *sum* of all groups
1031
+
**proportion-facet* - *sum* of the group divided by the total *sum* of groups in the current facet
1032
+
**deviation* - standard deviation of the values in the group
1033
+
**min* - minimum of the values in the group
1034
+
**max* - maximum of the values in the group
1035
+
**mean* - mean of the values in the group
1036
+
**median* - median of the values in the group
1037
+
**variance* - variance of the values in the group
1036
1038
1037
1039
#### Plot.group(*outputs*, *options*)
1038
1040
1039
-
Groups on *x*, *y*, and the first of *z*, *fill*, or *stroke*, if any.
1041
+
Groups on *x*, *y*, and the first of *z*, *fill*, or *stroke*, if any. The value channel is the input with the same name as the aggregation channel.
1042
+
1043
+
Examples:
1044
+
1045
+
```js
1046
+
Plot.group({fill:"count"}, {
1047
+
x:"island",
1048
+
y:"species"
1049
+
})
1050
+
```
1051
+
1052
+
```js
1053
+
Plot.group({fill:"max"}, {
1054
+
x:d=>d.date.getUTCDate(),
1055
+
y:d=>d.date.getUTCMonth(),
1056
+
fill:"temp_max"
1057
+
})
1058
+
```
1040
1059
1041
1060
#### Plot.groupX(*outputs*, *options*)
1042
1061
1043
-
Groups on *x* and the first of *z*, *fill*, or *stroke*, if any.
1062
+
Groups on *x* and the first of *z*, *fill*, or *stroke*, if any. The value channel is *y*.
1044
1063
1045
1064
#### Plot.groupY(*outputs*, *options*)
1046
1065
1047
-
Groups on *y* and the first of *z*, *fill*, or *stroke*, if any.
1066
+
Groups on *y* and the first of *z*, *fill*, or *stroke*, if any. The value channel is *x*.
1048
1067
1049
1068
#### Plot.groupZ(*outputs*, *options*)
1050
1069
1051
-
Groups on the first of *z*, *fill*, or *stroke*, if any; if none of *z*, *fill*, or *stroke* are channels, then all data (within each facet) is placed into a single group.
1070
+
Groups on the first of *z*, *fill*, or *stroke*, if any; if none of *z*, *fill*, or *stroke* are channels, then all data (within each facet) is placed into a single group. The value channel is the input with the same name as the aggregation channel.
0 commit comments