easystats / easystats/performance

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

Open
#674 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Waiting for response :love_letter:
Dominant language
R
Stars
1.2k
Forks
109
Avg merge
6h 34m
Merged PRs (30d)
8

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior with the check_model and ggsave entry points, comparing interactive use with execution from a script. Inspect how the check_model result is represented and rendered; done means establishing a supported scripted way to save the diagnostic plots or documenting that limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.