0

I am using sjPlot to plot marginal effects in an interaction, and although I was able to set the axis to go from 1 to 7, only values 2, 4, and 6 appear as tick marks on the graph; I would like all values (0-7) to appear. Thank you!

Code :

specif<- lmer(Lprog ~ phq9_total * Lspecif_C + (1|ID), Study1)

pspecif<-plot_model(specif,type="int", mdrt.values="meansd",
                title ="Specificity", 
                axis.lim = c(1,7), 
                axis.title= c("depression","goal progress"),
                colors = "simply",
                show.legend=FALSE)

pspecif + theme(plot.title = element_text(hjust = 0.5))  

output figure

  • Try with `+ scale_y_continuous(breaks = 0:7, limits = c(0, NA))`. With `breaks` you set the ticks, with `limits` you ensure the axis starts at 0. – stefan Oct 01 '21 at 16:47
  • Most likely when adding the scale you will be replacing an existing y-scale so you may need to use `%+%` instead of only `+`, and I am guessing the axis label may also need to set again with something like `%+% scale_y_continuous(name = "goal progress", breaks = 0:7, limits = c(0, NA))`. Without the data we cannot test if our answers are correct or help you more. Can you provide a reproducible example we can actually run? Anyway, also remember that if you find the answer yourself, it is very much appreciated if you enter it by yourself here, for future users. – Pedro J. Aphalo Oct 01 '21 at 19:06

0 Answers0