rsquaredacademy / olsrr

Tools for developing OLS regression models
https://olsrr.rsquaredacademy.com/
Other
102 stars 22 forks source link

Option not to print plots, but to return the plot object #135

Closed jmberros closed 4 years ago

jmberros commented 5 years ago

It would be useful to have an option to return ggplot objects instead of printing them, in the plot methods. This would allow to arrange the plots in a custom layout using grid.Extra or to modify some of the plot elements before printing them.

For instance ols_plot_resid_qq could end in a return (p) instead of a plot(p).

Screenshot from 2019-09-08 17-31-38

Or ols_plot_resid_lev, is printing and returning the plot in a list:

Screenshot from 2019-09-08 17-34-00

I would add an option that defaults to TRUE, print_plot = T to every plot method, so that the current behavior is not altered. What do you think?

aravindhebbali commented 5 years ago

Thanks for the suggestion @jmberros . Will do this in the upcoming release.