# Make cyl a factor (as it really should be)
mtcars2 <- mtcars
mtcars2$cyl <- factor(mtcars2$cyl)
# One line
mtcars2 %>% ggvis(~disp, ~mpg, stroke = ~cyl) %>% layer_paths()
# One line for each level of cyl
mtcars2 %>% ggvis(~disp, ~mpg, stroke = ~cyl) %>% group_by(cyl) %>%
layer_paths()
mtcars2 %>% ggvis(~disp, ~mpg, stroke = ~cyl) %>% auto_group() %>%
layer_paths()Run the code above in your browser using DataLab