Skip to content

How can I save the group of plots produced by check_model to a figure from within a script? #674

Open
@ZaidaEMtzMo

Description

Hello,

Sorry if this is not the right place, but I have been struggling with this all day and have tried to find an answer online but I couldn't.
Your library is amazing and produces the diagnostic plots that I just need. However, I don't seem to find a way to save them.
In the terminal, when I do check_model(analysis_model) it produces the plots without problem, and then I can do ggsave(directory, width=10,height=15,dpi=300) and it gets saved.
However, if I do that from within a script, it saves the latest figure I produced and not the one from check_model, even if I do check_model(analysis_model) right above ggsave...

I have also tried:

diagn_fig=check_model(analysis_model)
ggsave(directory,
       plot = diagn_fig,
       width = 10,
       height = 15,
       dpi = dpi)

But then I get the error:

Error in UseMethod("grid.draw") : 
  no applicable method for 'grid.draw' applied to an object of class "c('check_model', 'see_check_model')"

I am sure there is a way of saving the figures from within a script, but I just can't figure it out, so I would appreciate any help.
Thank you!

Metadata

Assignees

No one assigned

    Labels

    Waiting for response 💌Need more information from people who submitted the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions