Search code examples
rggplot2emmeans

emmeans: Make labeled means bigger


I'd like to make the EMMs, circled in the attached picture bigger. It looks like just increasing the y-axis label font size won't change the color-coded labels next to each wool:tension combination. Thanks for your attention.

model <- lm(breaks ~ wool * tension, data = warpbreaks)

emm <- emmeans(model, c("wool", "tension"))[![enter image description here][1]][1]

pwpp(emm, type = "response") +
    theme_bw() + 
  geom_point(aes(size = 3)) + 
  theme(text = element_text(size = 25)) +
  scale_size(guide = F)

enter image description here


Solution

  • This could be achieved via the aes argument of emmeans::pwpp which allows to set the size of labels, points and segments (see ?emmeans::pwpp):

    library(emmeans)
    library(ggplot2)
    
    model <- lm(breaks ~ wool * tension, data = warpbreaks)
    
    emm <- emmeans(model, c("wool", "tension"))
    
    pwpp(emm, type = "response", aes = list(label = list(size = 5))) +
      theme_bw() + 
      geom_point(aes(size = 3)) + 
      theme(text = element_text(size = 25)) +
      scale_size(guide = F)