layer_guess: Guess the right type of layer based on current properties.

View source: R/layer_guess.R

layer_guessR Documentation

Guess the right type of layer based on current properties.

Description

layer_guess provides the magic behind the default behaviour of ggvis.

Usage

layer_guess(vis, ...)

Arguments

vis

The visualisation to add the new layer to.

...

Other arguments passed on individual layers.

Defaults

  • Continuous x, layer_histograms

  • Categorical x, layer_bars

  • Continuous x and y, layer_points

Examples

# A scatterplot:
mtcars %>% ggvis(~mpg, ~wt)
mtcars %>% ggvis(~mpg, ~wt) %>% layer_guess()

# A histogram:
mtcars %>% ggvis(~mpg)
mtcars %>% ggvis(~mpg) %>% layer_guess()

ggvis documentation built on March 31, 2023, 7:13 p.m.