2016-11-16 5 views
1

RのスライドでGoogleモーションチャートを作成しようとしています。私はオンラインでたくさんの例を探しましたが、RスライディングスライドにGoogleモーションチャートを埋め込んだ人がいるようです。それで、私も同じようなコードを使って自分自身を試してみると、空白の結果が出ます。私はまた、Googleの円グラフを生成するために、同じ方法を使用して、それがうまく機能(円グラフはプロットエリアに表示されます)。ここgvisMotionChartがRの空白のプロットを返します。slidify

は、以下の私の単純化されたコードである(ここで私はちょうど他のすべてのようにフルーツデータセットを使用していますデモ):

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

``` 

それから私は、htmlファイルにコンパイルしslidify("demo.Rmd")を使用。最初のスライドにはプロットはありませんが、プロット領域は空白です。

---の設定、rマークダウンチャンクのオプション、またはブラウザ環境のいずれの部分がこの結果に影響を与えているか分かりませんか?

誰かが私にアイデアを与えてくれることを願っています。

答えて

0

Rのプロットコマンドは、この制限を克服するために内部R HTTPヘルプサーバーを使用します。

は、ここで私はそれを克服方法は次のとおりです。

Go to 

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html 

Click on the dropbox which says 'Edit location' and choose 'add location' 

Click 'browse for folder or browse for file' 

Choose the folder (or file) in which was your saved html output 

Click OK 

また、あなたのコードを変更することができ、例えば、私がやった:

suppressPackageStartupMessages(library(googleVis)) 

options(gvis.plot.tag='chart') 

M1 <- gvisMotionChart(Fruits, idvar="Fruit", timevar="Year") 

plot(M1) 

print(M1, file="myGoogleVisChart.html") 

今すぐあなたのgoogleVisのHTMLファイルを開くと、それが正常に表示されるはずです。

実際に、あなたが選択したフォルダ内から開くgoogleVisファイルも、期待どおりに表示されます。

私はMS Internet Explorerを使用していますが、上記の出力を表示する前にActiveXをアクティブにするように要求されていて、それは私のために働いていました。あなたが見ることができない場合

それでも、また確認してくださいについて:

https://cran.r-project.org/web/packages/googleVis/vignettes/googleVis.pdf 
関連する問題