Using ggvis with knitr and rmarkdown

# Set up default dimensions. Width and height are multiplied by dpi to get
# pixel dimensions.
knitr::opts_chunk$set(fig.width = 4, fig.height = 3)

To embed a ggvis plot just call ggvis:

library(ggvis)
mtcars %>% ggvis(x = ~wt, y = ~mpg) %>% layer_points()
mtcars %>% ggvis(x = ~wt, y = ~mpg) %>%
  layer_points() %>%
  layer_smooths()


Try the ggvis package in your browser

Any scripts or data that you put into this service are public.

ggvis documentation built on May 29, 2024, 1:12 a.m.