I have created the plot below to visualize interactions but I was wondering if I can customize the parts of the plot that say education = College, education = Graduate, education = High School.
Code:
# Generate example data
set.seed(123)
education <- factor(rep(c("High School", "College", "Graduate"), each = 30))
study_hours <- rep(c(10, 20, 30), each = 10, times = 3)
exam_scores <- rnorm(90, mean = 70, sd = 10)
# Create dataframe
example_df <- data.frame(education, study_hours, exam_scores)
# Fit the model with interaction term
library(glmmTMB)
models_example <- glmmTMB(exam_scores ~ education * study_hours, data = example_df)
# Generate the effects plot for the interaction term
library(effects)
effects_plot_example <- plot(allEffects(models_example, data = example_df))
# Display the plot
print(effects_plot_example)
Examples of what I tried:
- I attempted to rename the variable to
Educational Levelbefore plotting but the space gave me this error
Error in parse(text = paste("~", paste(extras, collapse = "+"))) :
<text>:1:28: unexpected symbol
- I tried several arguments in the
plot/allEffectsfunction likepanel.titlebut I can't find which could modify this part of the plot, I am not even sure how this part of the plot is called.

If you use
effects:::plot.eff()directly, it will produce aplot.effobject for which you can modify thestripfunction which is used to create the labels you want to change.