Domanda

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

È stato utile?

Soluzione 4

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

Altri suggerimenti

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.

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.

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!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top