【问题标题】:Include googleVis chart in ioslides RStudio在 ioslides RStudio 中包含 googleVis 图表
【发布时间】:2015-08-26 10:36:13
【问题描述】:

我有以下图表:

library(googleVis)
df = data.frame(models = c("PLAT", "LC", "APC", "CBD", "M6", "M7", "M8"), val = 1:7)
Column <- gvisColumnChart(df)
plot(Column)

我想把它放在 RStudio 的 ioslides 中。 谁能指导我怎么做?

【问题讨论】:

    标签: r rstudio presentation googlevis


    【解决方案1】:

    关键是使用options(gvis.plot.tag='chart')作为代码的一部分,这指示plot()函数只输出图表的html代码。代码如下:

    ## Another GoogleVis Slide
    
    Some text in slide
    
    ```{r warning=FALSE, message=FALSE, results='asis', tidy=FALSE}
    library(googleVis)
    
    op <- options(gvis.plot.tag = 'chart')
    
    df = data.frame(models = c("PLAT", "LC", "APC", "CBD", "M6", "M7", "M8"), val = 1:7)
    Column <- gvisColumnChart(df)
    plot(Column)
    ```
    

    您可以通过输入?plot.gvis 找到此内容,但我认为这并不明显,因此希望有人阅读此答案可以节省一些时间

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-08
      • 2018-02-21
      • 2016-06-27
      • 2020-08-03
      • 2015-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多