geom_rug

geom_rug

geom_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")

NutfhR.png
NuUnJA.png

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)

NutWN9.png

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)

Nut51x.png
NuUuRI.png

Author

Karobben

Posted on

2020-06-19

Updated on

2024-01-22

Licensed under

Comments