基本箱线图.png
偏态图形分析.png
library(MASS)
ggplot(birthwt, aes(x=factor(race), y=bwt)) + geom_boxplot()
birthwt
low age lwt race smoke ptl ht ui ftv bwt
0 19 182 2 0 0 0 1 0 2523
0 33 155 3 0 0 0 0 3 2551
0 20 105 1 1 0 0 0 1 2557
========================================
ggplot(birthwt, aes(x=factor(race), y=bwt))+geom_boxplot(width=.5)
width.5.png
ggplot(birthwt, aes(x=factor(race), y=bwt)) +geom_boxplot(outlier.size=1.5, outlier.shape=21)
ggplot(birthwt, aes(x=factor(race), y=bwt,colour=factor(race))) + geom_boxplot(outlier.size=1.5, outlier.shape=21)
更改异常值.png
填充颜色.png
添加均值.png
library(MASS) # For the data set
ggplot(birthwt, aes(x=factor(race), y=bwt)) + geom_boxplot() + stat_summary(fun.y="mean", geom="point", shape=23, size=3, fill="white")
添加均值.png