Hi Ramnath -
Hm, that error message isn't very informative. Do you mind filing an issue on that?
In ggplot2, grouping is done automatically if a discrete variable in the data is mapped to an aesthetic. When calculating transforms (like smooth), the data is split apart into pieces, and the transform is applied to each piece.
In ggvis (as of now) the grouping doesn't happen automatically when a variable in the data is mapped to a property. So in the layer_smooth, it's trying to calculate a single model line from all the data, but also map the cut variable for each point to the stroke color -- and those two things won't work together.
Here are two ways of doing this. (I'm also taking a subset of the diamonds data set, since there are some to-be-addressed bottlenecks that cause slow rendering for ~53k points.)
data('diamonds', package='ggplot2')
d <- diamonds[sample(nrow(diamonds), 1000), ]
# In this version, the grouping on cut is done for all layers, although it's
# only visible for the layer_smooth
ggvis(diamond, by_group(cut), props(x = ~carat, y = ~price)) +
# In this version, the grouping on cut is done only for the layer_smooth
ggvis(d, props(x = ~carat, y = ~price)) +
layer_point(props(opacity := 0.5)) +
layer(
by_group(cut),
layer_smooth(props(stroke = ~cut))
)
One thing we want to do for the future is to make the grouping simpler to use.
-Winston