I would like to change the color palette to two arbitrary HEX colors. How can I do it in the chart below?
hec <- as.data.frame(xtabs(Freq ~ Hair + Eye, HairEyeColor))
ggvis(~Hair, ~Eye, fill = ~Freq) %>%
layer_rects(width = band(), height = band()) %>%
scale_nominal("x", padding = 0, points = FALSE) %>%
scale_nominal("y", padding = 0, points = FALSE)
You need to set the
scale_numeric to change the start and end of a continuous fill gradient.
For example, if you wanted a range of red to green you would use
scale_numeric("fill", range = c("red", "green"))