介绍
gghalves
可以通过ggplot2
轻松地编写自己想要的一半一半(half-half plots)的图片。比如:在散点旁边显示箱线图、在小提琴图旁边显示点图。
gghalves[1]将_half_
扩展添加到选定的geom
。比如:geom_half_violin()
函数,相当于geom_violin()
函数的变体,该函数主要作用就是展示一半的小提琴图,然后与其他图形组合。还包含以下函数:
-
geom_half_boxplot
-
geom_half_violin
-
geom_half_point
安装
gghalves通过GitHub安装:
if (!require(devtools)) {
install.packages('devtools')
}
devtools::install_github('erocoar/gghalves')
函数介绍
geom_half_violin(mapping = NULL, data = NULL, stat = "half_ydensity",
position = "dodge", ..., side = "l", nudge = 0,
draw_quantiles = NULL, trim = TRUE, scale = "area",
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE)