hc %>%
hc_add_series(name = "London", data = citytemp$london, type = "area") %>%
hc_rm_series(name = "New York")
我要出口hc
作为 png 或 jpg。这可以通过选择导出 - 另存为图像来完成,但我想通过代码来完成,因为我有多个要导出的图。我已尝试以下操作,但它返回了空白图像:
png('hc.png', width = 800,height = 400)
print(hc)
dev.off()
这应该可以通过 webshot 包实现(请参阅此处的问题:https://github.com/jbkunst/highcharter/issues/186 https://github.com/jbkunst/highcharter/issues/186)
library(webshot)
library(highcharter)
library(plyr)
data("citytemp")
plot <- highchart() %>%
hc_add_series(name = "London", data = citytemp$london, type = "area") %>%
hc_rm_series(name = "New York")
htmlwidgets::saveWidget(widget = plot, file = "~/plot.html")
setwd("~")
webshot::webshot(url = "plot.html",
file = "plot.png")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)