How can I specify y-limits in the plots produced by brms::marginal_effects()?

Viewed 828

Here's my example code. I'd like to produce several variations of the same plot, so enforcing identical y-limits is important for visual comparison.

library(brms)

# data
sgf <- c(rep("A",10),rep("B",10))
Vs  <- c(221, 284, 211, 232, 254, 
         260, 239, 219, 226, 232, 
         388, 399, 421, 419, 332, 
         387, 399, 398, 438, 411)
vspr.df <- data.frame(sgf, Vs)

# perform fit
fit <- brm(formula = Vs ~ sgf,
  data = vspr.df,
  family = lognormal(),
  prior = NULL,
  chains=3,
  iter=300,
  warmup=100)

p <- marginal_effects(fit)
plot(p)
plot(p, ylim=c(0,350))   # no effect
plot(p, ylim=c(0,3500))  # no effect

My preferred result is for each of the last 3 lines to result in a plot with different Y limits.

1 Answers
Related