This is a demo of ggvis. * The ggvis API is currently rapidly evolving. The authors of the package strongly recommend that you do not rely on this for production

Scatter Plots

library(ggvis)
mtcars %>%
  ggvis(~mpg, ~disp) %>%
  layer_points() %>%
  set_options(height = 300, width = 400)

10121416182022242628303234mpg100150200250300350400450disp

mtcars %>% 
  ggvis(~mpg, ~disp, fill = ~vs) %>% 
  layer_points() %>%
  set_options(height = 300, width = 400)

10121416182022242628303234mpg100150200250300350400450dispvs0.01.0

Combo Plot

mtcars %>% ggvis(~wt, ~mpg) %>%
  layer_smooths(span = 1) %>%
  layer_smooths(span = 0.3, stroke := "red") %>%
  set_options(height = 300, width = 400)

1.52.02.53.03.54.04.55.05.5wt1214161820222426283032mpg

Regression Line

mtcars %>% 
  ggvis(~wt, ~mpg) %>%
  layer_points() %>%
  layer_smooths() %>%
  set_options(height = 300, width = 400)

1.52.02.53.03.54.04.55.05.5wt10121416182022242628303234mpg

mtcars %>% 
  ggvis(~wt, ~mpg) %>%
  layer_points() %>%
  layer_model_predictions(model = "lm", se = TRUE) %>%
  set_options(height = 300, width = 400)

1.52.02.53.03.54.04.55.05.5wt5101520253035mpg

Scatter plots with grouping

mtcars %>% 
  ggvis(~wt, ~mpg) %>% 
  layer_points(fill = ~factor(cyl)) %>%
  set_options(height = 300, width = 400)

1.52.02.53.03.54.04.55.05.5wt10121416182022242628303234mpgfactor(cyl)468

mtcars %>% 
  ggvis(~wt, ~mpg, fill = ~factor(cyl)) %>% 
  layer_points() %>% 
  group_by(cyl) %>% 
  layer_model_predictions(model = "lm") %>%
  set_options(height = 300, width = 400)

1.52.02.53.03.54.04.55.05.5wt10121416182022242628303234mpgfactor(cyl)468

Bar Plots

pressure %>% 
  ggvis(~temperature, ~pressure, fill := 'green') %>%
  layer_bars(width = 10) %>%
  set_options(height = 300, width = 400)

050100150200250300350temperature0100200300400500600700800pressure

Line Plot

pressure %>% ggvis(~temperature, ~pressure) %>%
  layer_points(fill := 'blue') %>% 
  layer_lines() %>%
  set_options(height = 300, width = 400)

050100150200250300350temperature0100200300400500600700800pressure

Box Plot

mtcars %>% 
  ggvis(~factor(cyl), ~mpg) %>% 
  layer_boxplots(stroke = ~factor(cyl)) %>%
  set_options(height = 300, width = 400)
## Warning in rbind_all(out[[1]]): Unequal factor levels: coercing to
## character

468factor(cyl)10121416182022242628303234mpgfactor(cyl)468

References