rexportpnggooglevis

R googleVis to png file


I have the following code that works fine. I would like to know if it's possible to take this and export it as a png file. Anyone know of an easy way to do this. I'm just getting started in the R world so a noob.

Here is my code

library(RODBC)
library(googleVis)

con <- odbcConnect("Live", uid="Rxyzuser", pwd="xxxxx")
attendees <- sqlQuery(con, "exec rpt_r_vis")

regCal <- gvisCalendar(attendees, 
                       datevar="Reg_add_date", 
                       numvar="Counts",
                       options=list(
                         title = "Registrations per Day Heatmap",
                         height = 400, width=1000,
                         calendar="{yearLabel: { fontName: 'Times-Roman',
                                    fontSize: 32, color: '#1A8663', bold:     true}, cellSize: 15,
                                    cellColor: { stroke: 'red', strokeOpacity: 0.2 },
                                    focusedCellColor: {stroke: 'red'}}")
  )
plot(regCal)


odbcCloseAll()

Solution

  • did you try:

    png("sample.png",width = 480, height = 480, units = "px")
    plot(regCal)
    dev.off()
    

    Best,

    Robert