From my testing, it appears that the function you’re using to determine the title prop receives one of the elements from the data array. Therefore, if the elements are arrays, you can use map. If they’re objects, you can’t (but you can access the properties). This should work in the second example from your notebook:
In a Plot.group (or Plot.bin) transform, you can set the title in two places:
in the first part (the outputs), the title property describes a reducer that defines how a summary value is computed for each group. The reducer is applied on the grouped values from the title channel—or, by default, to the grouped values from the data array.
in the second part (the options), the title property describes the input title channel, indexed on the data.
So if you have, e.g.:
Plot.group({
title: group => d3.mode(group)
},
{
title: "a"
}
)
it is equivalent to:
Plot.group({
title: group => d3.mode(group, d => d.a)
},
{}
)
In your notebook, however, no reducer is defined for the title group option, so it defaults to a function that counts the occurrences in each group and returns the top 5, together with a count. Which is why you see “Y (1)”. This function is a special case (only used as the default title reducer), which I realize has not been documented yet.