Wrong ggvis graph size in interactive R Markdown

I am trying to add an interactive ggvis chart in an R Markdown interactive file. It works great, except that the plot size is larger than the assigned space, and I always get a "cut" plot and bar. I tried chunk options (out.height and fig.height) or ggvis set_options with no success. The following is an example. Thanks

---
title: "Untitled"
runtime: shiny
output: html_document
---

```{r, echo = FALSE}
library(ggvis)
mtcars %>%
  group_by(am) %>%
  ggvis(~ x_, ~ count_/sum(count_), fill = ~am) %>%
  compute_bin(~mpg, width = input_slider(min = 1, max = 10)) %>%
    layer_bars(stack = FALSE, opacity := 0.5) %>%
  add_axis("x", title = "mpg", grid = FALSE) %>%
  add_axis("y", title = "Proportion", grid = FALSE, format = "%")
```
+4
source share

All Articles