deepviz icon indicating copy to clipboard operation
deepviz copied to clipboard

Any easy way to export an image?

Open nateGeorge opened this issue 5 years ago • 2 comments

I was trying to save an image as so in Rstudio:

jpeg(file = '/home/nate/github/neural_net_prototyping/images/simple.model.jpg')
plot_model(simple.model)
dev.off()

But it doesn't seem to be working. Any ideas on how to save a model programmatically?

nateGeorge avatar Mar 26 '19 01:03 nateGeorge

Good question.

The resulting object is an htmlWidget and can be programmatically accessed using the webshot package. In the Readme.rmd of this package I have examples of this, using this code:

htm_file <- tempfile(fileext = ".html")
model %>% plot_model() %>% 
  htmlwidgets::saveWidget(htm_file)
webshot::webshot(htm_file, file = tempfile(fileext = ".png"))

We should really document this and perhaps create a simple wrapper function to export to png format.

andrie avatar Apr 08 '19 07:04 andrie

Ah, of course. Maybe mentioning this in the README.md would be good? Not providing the full code necessary, just saying it's in the Readme.rmd

nateGeorge avatar Apr 16 '19 00:04 nateGeorge