`theme` argument of `check_model()` has no effect.
Taking a simple case from the documentation: https://easystats.github.io/performance/reference/check_model.html
library(ggplot2)
library(performance)
m <- lm(mpg ~ wt + cyl + gear + disp, data = mtcars)
p0 <- check_model(m)
p1 <- check_model(m, theme = "ggplot2::theme_dark")
p1
The theme argument should work with the default print method.
Maybe a problem with see not reading the attribute.
edit: it feels like the theme/style option is broken in see as an explicit call to plot() is required for theme to "work". Unfortunately, it actually does not work since the function has a lot of non default arguments which means no other theme than the provided one can work.
library(see)
plot(p1)
plot(p1, style = ggplot2::theme_dark)
#> Error in theme_style(base_size = base_size, plot.title.space = 3, axis.title.space = 5, :
#> unused arguments (plot.title.space = 3, axis.title.space = 5, axis.title.size = size_axis_title, plot.title.size = size_title)
Feel free to transfer to see as I think it mostly comes down to this package rather than performance in the end.
The approach to pass the theme adds a lot of limitations in addition to the issue with arguments, for example:
my_theme <- function(
base_size = 11,
base_family = "",
base_line_size = base_size / 22,
base_rect_size = base_size / 22,
...
) {
ggplot2::theme_dark(
base_size = base_size,
base_family = base_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size
)
}
p1 <- check_model(m, theme = "my_theme")
plot(p1) # won't work because the theme function has to come from a package
plot(p1, style = my_theme)
check_model() theme argument should simply allow a theme function, then the plot() method would use that directly without trying to parse the string.
- https://github.com/easystats/see/blob/3f5446b797179e75a8842f2ab372e2449ca187ea/R/plot.check_model.R#L64-L67
Hi! I'd like to work on this issue. The root cause is that the plot method tries to parse theme strings and calls them with hardcoded arguments that don't exist in standard ggplot2 themes. I will be modifying plot.check_model() in the see package to accept theme functions directly and apply them without extra arguments, which would support both built-in and custom themes.