0 Posted 2020-06-19Updated 2024-01-11R / Plot / GGPLOT2 minutes read (About 278 words)geom_ruggeom_rug Quick Inst library(ggplot2)library(patchworks)ggplot(mtcars,aes(wt,mpg))+ geom_point( color="grey50") + geom_rug() + theme_light() arguments outside ggplot(mtcars,aes(wt,mpg))+ geom_point( color="grey50") + theme_light()+geom_rug( outside = TRUE)+ coord_cartesian(clip = "off") side 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) length P1<- ggplot(mtcars,aes(wt,mpg))+ geom_point( color="grey50") + theme_light()+ geom_rug()+ ggtitle('NA') + theme(plot.title = element_text(hjust = 0.5))P2<- ggplot(mtcars,aes(wt,mpg))+ geom_point( color="grey50") + theme_light()+ geom_rug( length = unit(0.5, "npc"))+ ggtitle('0.5') + theme(plot.title = element_text(hjust = 0.5))P3<- ggplot(mtcars,aes(wt,mpg))+ geom_point( color="grey50") + theme_light()+ geom_rug( length = unit(1, "npc"))+ ggtitle('1') + theme(plot.title = element_text(hjust = 0.5))P1/(P2|P3) geom_rughttps://karobben.github.io/2020/06/19/R/geom_rug/AuthorKarobbenPosted on2020-06-19Updated on2024-01-11Licensed under#RPlotggplot