R 在有光泽的文档中显示ggvis绘图

R 在有光泽的文档中显示ggvis绘图,r,shiny,ggvis,R,Shiny,Ggvis,ggvis正在处理闪亮的文档吗 在本例中,ggplot可见,但ggvis不可见 --- title: "testShiny" runtime: shiny output: html_document --- ggplot2 ```{r, echo=FALSE} require(ggplot2) renderPlot({ ggplot(women, aes(height, weight))+ geom_point()+ theme_bw() }) ``` gg

ggvis正在处理闪亮的文档吗

在本例中,ggplot可见,但ggvis不可见

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

ggplot2

```{r, echo=FALSE}

require(ggplot2)

renderPlot({
  ggplot(women, aes(height, weight))+
    geom_point()+
    theme_bw()

  })

```

ggvis

```{r, echo=FALSE}

require(ggvis)

renderPlot({
  women %>%
    ggvis(x= ~height, y = ~weight) %>%
    layer_points()

  })

```

在搜索时,我遇到了bind_Shining,但它没有解决问题

您需要使用
bind_Shining
为可视化分配一个id。然后需要使用
ggvisOutput
在DOM中创建一个元素来显示可视化:

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

```{r, echo=FALSE}

require(ggvis)
require(knitr)
require(shiny)

ggvisOutput("p")

women %>%
  ggvis(x= ~height, y = ~weight) %>%
  layer_points()%>%
  bind_shiny("p")

```

非常好用,谢谢。你知道为什么在调用绘图之前必须先输入
ggvisOutput(“p”)
吗?我认为顺序应该无关紧要。我只是倾向于将
ui.R
对象放在
server.R
上。