I would like to modify this graph:
- Shorten the lines to only display from -1 SD to + 1SD for the weight variable
- Cap each line with a square or triangle symbol
- Change the x-axis to display Low weight and High weight instead of the digits and tick marks.
library(tidyverse)
dat=mtcars
mod <- lm(mpg ~ gear * wt, data=dat)
apatheme=theme_bw()+
theme(panel.grid.major=element_blank(),
panel.grid.minor=element_blank(),
panel.border=element_blank(),
axis.line=element_line(),
text=element_text(family='Times'),
legend.title=element_blank())
p=ggplot(dat, aes(x = wt, y = mpg, size = gear))+
geom_blank()+
labs(x = 'Vehicle Weight', y = 'Vehicle MPG')+
scale_size_continuous(guide = FALSE)+
geom_abline(aes(intercept=33.965, slope=-4.3985, linetype='-1SD Gear'))+
geom_abline(aes(intercept=42.2767, slope=-7.3095, linetype='+1SD Gear'))+
scale_linetype_manual(values=c('dotted','dashed','solid'),
breaks=c('-1SD Gear','Mean Gear','+1SD Gear'),name='Simple\nSlope')+
apatheme
p
Here is what it currently produces
I am trying to get it closer to this APA style version


