Trouble with GoogleViz Motion Chart
Description of Problem
In our last session "Advanced R", some students had trouble rendering the googleViz motion chart from the last example. For some students, the call
plot(outChart)
correctly generates a motion chart that automatically opens in a browser. For other students, the same call yields a javascript output.
We have not yet been able to identify if this is a versioning issue for R or the package, or an OS related issue. (See comments below.)
Resolution
We are still looking into how to resolve this problem for students that cannot render the image. Please check-back soon.
If you know a solution, please feel free to edit this page. If you have additional details (package version, OS version, R version etc.) needed to reproduce the problem, please add them to the comments section of this page.
The problem is probably due to the value option gvis.plot.tag, which should be NULL by default. To get the value of this option, use the command getOption("gvis.plot.tag").
Here are two ways display the googleVis chart "outChart":
1: Set the option gvis.plot.tag to NULL by using the command options(gvis.plot.tag=NULL). Then, the command plot(outChart) will display the chart in a local browser instead of printing code.
2: Print the chart to a .html file and then display that file. For example, to print the chart to the file "outChart.html" in the current working directory, type print(outChart, file="outChart.html"). The command plot.gvis("outChart.html") will display the chart in a local browser.
See sections 2.4 and 2.5 of http://cran.r-project.org/web/packages/googleVis/vignettes/googleVis.pdf for more information.
1 Comment
David Erik Fagnan
I am still not sure why it worked out of box in R for some people, but if you run a local web host (as we did in the visualization class using python), and paste the javascript output from R to a file, it works.