--原文链接--


上图为使用ggplot2包绘制的箱型图,中间加了切口,切口的大小可以通过参数进行调节,使用的数据集为diamonds数据。

library(ggplot2)
data(diamonds)
ggplot(diamonds)+
geom_boxplot(aes(cut,price,fill=cut),notch=T,notchwidth=0.2,varwidth = T)+
scale_fill_manual(values=palette("Set1"))+
theme_bw()
写在文末:
文章首发于公众号:R语言搬运工
关注带来更多精彩
网友评论