0

According to this thread: dygraph in R multiple plots at once I have learned how to make multiple chart using htmltools package. Now I would like to save the output:

library(dygraphs)
library(htmltools)
library(quantmod)#to fetch data
library(lubridate)

getSymbols(c("AAPL","AMZN"))

dyg1 =  dygraph(AAPL[paste(ymd("2015-01-01"),ymd("2020-01-01"),sep = "::"),6]) 
dyg2 =  dygraph(AMZN[paste(ymd("2015-01-01"),ymd("2020-01-01"),sep = "::"),6]) 

jpeg("my_plot_name.jpg")
dy_graphs = list(dyg1,dyg2)
htmltools::browsable(htmltools::tagList(dy_graphs))
dev.off()

This code works however saved file is blank (white) jpg file. What am I doing wrong here?

Alexandros
  • 331
  • 1
  • 14
  • 1
    Why don't you copy your code in a Markdown Notebook chunck (without dev.off()) : I tried, it works and creates a HTML file with the two graphs. – Waldi Jun 08 '20 at 13:01
  • 1
    Does this post help you? [How to save interactive charts from dygraph](https://stackoverflow.com/questions/29094507/how-to-save-interactive-charts-from-dygraph) – Eric Jun 08 '20 at 13:03
  • Thank you, I used markdown and it`s good enough. – Alexandros Jun 10 '20 at 08:46

0 Answers0