deepviz
deepviz copied to clipboard
Any easy way to export an image?
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?
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.
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