2014-07-05 3 views
3

ggvis는 반짝이는 문서로 작동합니까? 이 예에서 반짝이는 문서에 ggvis 플롯 표시

는 ggplot는 볼 수 있지만이 bind_shiny 우연히 검색하는 동안하지

--- 
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() 

    }) 

``` 

입니다 ggvis,하지만 당신은 ID를 할당 할 bind_shiny를 사용할 필요가 문제를

답변

3

가 해결되지 않는 시각화에. 그런 다음 시각화를 표시 할 DOM의 요소를 만들 ggvisOutput를 사용해야합니다 :

--- 
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") 

``` 

enter image description here

+0

작품 완벽하게, 감사합니다. 플롯이 호출되기 전에'ggvisOutput ("p")'가 와야하는 이유를 알고 있습니까? –

+0

나는 순서가 중요하다고 생각할 것이다. 나는'ui.R' 개체 beore'server.R'을 넣는 경향이 있습니다. – jdharrison

관련 문제