R可视化手册-描述数据分布-箱线图

R可视化手册-描述数据分布-箱线图_第1张图片
基本箱线图.png
R可视化手册-描述数据分布-箱线图_第2张图片
偏态图形分析.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)
R可视化手册-描述数据分布-箱线图_第3张图片
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)
R可视化手册-描述数据分布-箱线图_第4张图片
更改异常值.png
R可视化手册-描述数据分布-箱线图_第5张图片
填充颜色.png
R可视化手册-描述数据分布-箱线图_第6张图片
添加均值.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")
R可视化手册-描述数据分布-箱线图_第7张图片
添加均值.png

你可能感兴趣的:(R可视化手册-描述数据分布-箱线图)