train_tbl %>%group_by(season) %>%ggvis(temp_f,count, stroke = ~factor(season)) %>%layer_smooths()
`1. layer_points()`
`2. layer_lines()`
`3. layer_bars()`
`4. layer_smooths()`
`5. layer_histograms()`
ggvis() is applied globally. While a property set inside layer_<marks>() is applied locally. scale_datetime(), scale_logical(), scale_nominal(), scale_numeric(), scale_singular()faithful %>%ggivs(eruptions,waiting, fill = ~eruptions) %>%layer_points() %>%scale_numeric("fill", range = c("red","orange"))
group_by() creates unique groups for each distinct combination of values within the grouping variables. ungroup() can remove the grouping information.interaction() can map the properties to unique combinations of the variablestrain_tbl %>%group_by(season,holiday) %>%ggvis(count, fill = interaction(season,holiday)) %>%layer_densities()
layer_model_predictions(model = "lm")faithful %>% ggvis(eruptions,waiting) %>% layer_points(fill := "green", fillOpacity := 0.5) %>% layer_model_predictions(model = "lm", stroke := "red") %>% layer_smooths(stroke := "skyblue")
input_checkbox(), input_checkboxgroup(), input_numeric(), input_radiobuttons(), input_select(), input_slider(), and input_text().add_axis()faithful %>%ggvis(eruptions,waiting) %>%add_axis("x", label = "Eruptions", values = c(1,2,3,4), subdivide = 9, orient = top") %>%layer_points()ggvis adds a legend for each property that is specified. To combine multiple legends into a single legend with common values, use a vector of property names. add_legend()hide_legend()faithful %>% ggvis(waiting, eruptions, opacity := 0.6, fill = factor(round(eruptions)), shape = factor(round(eruptions)), size = round(eruptions)) %>% layer_points() %>% add_legend(c("fill", "shape", "size"), title = " duration (m)", values = c(2, 3, 4, 5))No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.