我想放大dygraphs并将图像保存为png。我使用dygraph库绘制图形并将其保存为png,但它没有放大版本。
library("webshot")
library("htmlwidgets")
lungDeaths <- cbind(ldeaths, mdeaths, fdeaths)
dygraph(lungDeaths, main = "Deaths from Lung Disease (UK)") %>%
dyHighlight(highlightCircleSize = 5,
highlightSeriesBackgroundAlpha = 0.2,
hideOnMouseOut = FALSE)
saveWidget(ab, "/path/", selfcontained = TRUE, libdir = NULL)
basePng <- paste("images",paste(file,".png"), sep='/')
webshot::webshot("/path/",file=basePng)
但我想要下面的情节(放大):
我想在dygraph中绘制超过1000个文件的缩放图。有谁可以帮我这个?
答案 0 :(得分:1)
我希望这个答案可以帮助任何人,
我使用dyRangeSelector()
“缩放”图形,然后webshot
进行保存。
library(webshot)
library(htmlwidgets)
library(dygraphs)
# webshot::install_phantomjs()
lungDeaths <- cbind(ldeaths, mdeaths, fdeaths)
dygraph(lungDeaths, main = "Deaths from Lung Disease (UK)") %>%
dyRangeSelector( dateWindow = c("1974-03-1","1974-06-10")) %>%
dyHighlight(highlightCircleSize = 5,
highlightSeriesBackgroundAlpha = 0.2,
hideOnMouseOut = FALSE)
saveWidget(ab,file ="ab.html", selfcontained = TRUE, libdir = NULL)
webshot(url = "ab.html",file="ab.png")