在 R 中放大 dyGraphs 并将图像另存为 png
Zoom In dyGraphs in R and save image as png
我想放大 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 个文件。谁能帮我解决这个问题?
希望这个回答能对大家有所帮助,
我在图上用dyRangeSelector()
到"zoom",然后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")
我想放大 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 个文件。谁能帮我解决这个问题?
希望这个回答能对大家有所帮助,
我在图上用dyRangeSelector()
到"zoom",然后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")