library(patchwork) P1 <- ggplot(mtcars,aes(wt,mpg))+ geom_point( color="grey50") + theme_light()+ geom_rug( sides='t', color='red') + ggtitle('t') +theme(plot.title = element_text(hjust = 0.5)) P2 <- ggplot(mtcars,aes(wt,mpg))+ geom_point( color="grey50") + theme_light()+ geom_rug( sides='r', color='red') + ggtitle('r') +theme(plot.title = element_text(hjust = 0.5)) P3 <- ggplot(mtcars,aes(wt,mpg))+ geom_point( color="grey50") + theme_light()+ geom_rug( sides='b', color='red') + ggtitle('b') +theme(plot.title = element_text(hjust = 0.5)) P4 <- ggplot(mtcars,aes(wt,mpg))+ geom_point( color="grey50") + theme_light()+ geom_rug( sides='l', color='red') + ggtitle('l') +theme(plot.title = element_text(hjust = 0.5))
(P1|P2)/(P3|P4)
|