geom_tufteboxplot | ggplot examples | Another boxplot

geom_tufteboxplot | ggplot examples | Another boxplot

Quick Start

library(ggplot2)
library(patchwork)
p <- ggplot(mtcars, aes(factor(cyl), mpg))
### with a point for the median and lines for whiskers
P1 <- p + geom_tufteboxplot() + theme_light()+ ggtitle('P1')+
theme(plot.title = element_text(hjust = 0.5))
### with a line for the interquartile range and points for whiskers
P2 <- p + geom_tufteboxplot(median.type = "line", whisker.type = "point", hoffset = 0)+
theme_light()+ ggtitle('P2')+theme(plot.title = element_text(hjust = 0.5))
### with a wide line for the interquartile range and lines for whiskers
P3 <- p + geom_tufteboxplot(median.type = "line", hoffset = 0, width = 3) +
theme_light()+ ggtitle('P3')+theme(plot.title = element_text(hjust = 0.5))
### with an offset line for the interquartile range and lines for whiskers
P4 <- p + geom_tufteboxplot(median.type = "line") + theme_light()+ ggtitle('P4')+
theme(plot.title = element_text(hjust = 0.5))
P5 <- p + geom_point() + theme_light() + ggtitle('Scatter')+
theme(plot.title = element_text(hjust = 0.5))
P6 <- p + geom_boxplot()+ theme_light()+ ggtitle('Boxplot')+
theme(plot.title = element_text(hjust = 0.5))

(P1|P2|P3)/(P5|P4|P6)

geom_tufteboxplot

geom_tufteboxplot | ggplot examples | Another boxplot

https://karobben.github.io/2020/08/13/R/geom_tufteboxplot/

Author

Karobben

Posted on

2020-08-13

Updated on

2024-01-22

Licensed under

Comments