-
-
Notifications
You must be signed in to change notification settings - Fork 102
Description
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.