I would like to use ggvis
to achieve what is answered by this similar question: Colouring plot by factor in R
Using the mtcars
dataset as an example, and taken from layers: Grouping:
data(mtcars)
mtcars %>%
dplyr::mutate(cyl2 = factor(cyl)) %>%
ggvis(~wt, ~mpg, stroke = ~cyl2) %>%
layer_lines()
produces
with default factor colours given by stroke = ~cyl2
.
How do I change these default colours?