I am making use of the plot_model() predictive function for a multiple linear regression and am not able to modify aesthetics. I have read both that it is a part of the sjplot package as well as a wrapper for ggplot. While I have gotten pretty proficient in modifying/debuggin ggplot aesthetics, I am finding this not working here.
It plots just fine in my code as is. I've put placeholder names for the variables.
library(sjPlot)
library(performance)
library(ggplot2)
library(sjmisc)
setwd("C:/Users/directory/")
df=read.csv('example.csv')
df$id=factor(df$id)
df$course=factor(df$course)
lm_mod=lm(data=df, score~var1+var2+var3)
summary(lm_mod)
prediction = plot_model(lm_mod,
type="pred",
show.data=TRUE,
dot.size = 1,
)
prediction
As soon as I add themes, it returns NULL.
prediction + set_theme(base = theme_minimal())
I want to adjust the axis scale / limits to match my other ggplot made figures. The text size of the axis I would like to fix also. Image below, with the variable names removed

If I try anything from sjplot or ggplot to modify the aesthetics/themes, they all universally return "NULL." Some examples below:
> prediction + font_size(axis_title.x=28)
NULL
> prediction + font_size(28)
NULL
> prediction + set_theme(base = theme_minimal())
NULL
> prediction + theme_sjplot(base_size = 24, base_family="")
NULL
> prediction + theme(text=element_text(size=22),
+ axis.title = element_text(size=28,
+ face="bold" ),
+ axis.text = element_text(size=24),
+ axis.line = element_line(colour = "black",
+ size = 1,
+ linetype = "solid"),
+ plot.title = element_text(size=28,
+ face="bold",
+ vjust=2,
+ hjust=0.5))
NULL
I have read related posts. Please help! I am very stuck trying to fix this.
If you look at the help page
?plot_model, under Value it states:Here's a simple example:
So
p1is aggplotobject and you could do this:But
p2is a named list. It gets its name from the independent variable in the model. You'll get NULL if you try to add themes to a list.So to access the
ggplotpart of the list, you can do this:or this:
With more than one independent variable, you'll get a list element for each one. In your case: