This cheat sheet is made for the ggvis library in R for effective visualization of data
mtcars %>% ggvis(~mpg, ~disp, fill = ~vs) %>% layer_points()
mtcars %>% ggvis(~wt, ~mpg) %>%
layer_smooths(span = 1) %>%
layer_smooths(span = 0.3, stroke := "red")
train_tbl %>%
group_by(season) %>%
ggvis(~temp_f,~count, stroke = ~factor(season)) %>%
layer_smooths()
Any visual property in the visualization can be adjusted with scale().
ggvis provides several different functions for creating scales:
scale_datetime(), scale_logical(), scale_nominal(), scale_numeric(), scale_singular()
Code
faithful %>%
ggivs(~eruptions,~waiting, fill = ~eruptions) %>%
layer_points() %>%
scale_numeric("fill", range = c("red","orange"))
train_tbl %>%
group_by(season,holiday) %>%
ggvis(~count, fill = ~interaction(season,holiday)) %>%
layer_densities()
faithful %>%
ggvis(~eruptions,~waiting) %>%
layer_points(fill := "green", fillOpacity := 0.5) %>%
layer_model_predictions(model = "lm", stroke := "red") %>%
layer_smooths(stroke := "skyblue")
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.