R googleVis to png file

≯℡__Kan透↙ 提交于 2019-12-24 15:03:32

问题


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

回答1:


did you try:

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

Best,

Robert



来源:https://stackoverflow.com/questions/33546394/r-googlevis-to-png-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!