我試圖在R滑動中生成谷歌運動圖表。我在網上查了很多例子,似乎有些人已經成功將Google運動圖嵌入到R滑動幻燈片中。然後當我使用類似的代碼嘗試我自己的時候,它給了我空白的結果。我也用同樣的方法制作一個谷歌餅圖和它運作良好(餅圖顯示在繪圖區)gvisMotionChart在R中返回空格plotify
下面是我下面的簡化代碼(這裏我用的是水果數據集就像所有其他演示):
---
title: "Title"
author: "Me"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output:
ioslides_presentation:
incremental: yes
transition: default
widescreen: yes
slidy_presentation:
incremental: yes
job: Job Title
license: by-nc-sa
mode: selfcontained
hitheme: tomorrow
highlighter : highlight.js
subtitle: Subtitle
framework: io2012
widgets: []
---
## GoogleVis Motion chart example
```{r motionchartcode1, results='asis', warning=FALSE, comment=NA}
library(googleVis)
options(gvis.plot.tag='chart')
M <- gvisMotionChart(Fruits, 'Fruit', 'Year',
options=list(width=400, height=350))
#plot(M)
print(M, tag = 'chart')
```
---
## GoogleVis Pie chart example
```{r motionchartcode, results='asis'}
library(googleVis)
options(gvis.plot.tag='chart')
Pie <- gvisPieChart(CityPopularity,
options=list(width=400, height=200))
print(Pie, tag = 'chart')
```
然後我用slidify("demo.Rmd")
將它編譯成html文件。第一張幻燈片沒有繪製任何繪圖,而是繪製了一個空白區域。
我不確定哪個部分影響到這個結果:---
部分中的設置,r降級塊或我的瀏覽器環境中的選項?
希望有人可以給我的想法。