Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any easy way to export an image? #10

Open
nateGeorge opened this issue Mar 26, 2019 · 2 comments
Open

Any easy way to export an image? #10

nateGeorge opened this issue Mar 26, 2019 · 2 comments

Comments

@nateGeorge
Copy link

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?

@andrie
Copy link
Owner

andrie commented Apr 8, 2019

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.

@nateGeorge
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants