user1234440
user1234440

Reputation: 23567

Non-interactive GoogleVis charts

Is it possible for googleVis Package from R to generate Images as oppose to interactive charts? To create a GoogleVis Chart in R:

library(googleVis)
M <- gvisMotionChart(Fruits, "Fruit", "Year")
plot(M)

This initiates a browser and then it will plot an interative chart. Is there a way such that I can create a non-interactive image and plot it in R

Upvotes: 1

Views: 1219

Answers (4)

peter_w
peter_w

Reputation: 303

There's no real need to use googleVis for this. If you create your plot in ggplot2, the ggthemes add-on package has theme_gdocs(), and associated colour palettes that will let you style your chart exactly like a Google Chart.

Upvotes: 1

Bryan
Bryan

Reputation: 225

What I have done is a complete hack, but it works. I view the HTML for the googleVis object generated and extract the svg. I save the svg as a file and open it in an image editor that can open and convert svg files.

Upvotes: 2

user1234440
user1234440

Reputation: 23567

Some hacks I found that could potentially be able to convert gvis charts to images:

http://html2canvas.hertzen.com/

https://gist.github.com/battlehorse/1333906

Upvotes: 0

Remko Duursma
Remko Duursma

Reputation: 2821

It looks like the only way to do this is to make the interactive plot, and take a screenshot. The object returned by googleVis is a Flash application embedded in html, I think you probably cannot expect it to give a static plot!

Upvotes: 0

Related Questions