一、箱线图
代码语言:javascript复制ToothGrowth
boxplot(len ~ dose, data = ToothGrowth)
boxplot(len ~ supp, data = ToothGrowth)
boxplot(len ~ dose:supp, data = ToothGrowth)
# boxplot(len ~ dose supp, data = ToothGrowth)
boxplot(len ~ supp dose, data = ToothGrowth)
library(RColorBrewer)
brewer.pal(n = 3,name = 'Set2')
boxplot(len ~ supp dose, data = ToothGrowth,
col = c("#66C2A5","#FC8D62"))
boxplot(len ~ supp dose, data = ToothGrowth,
col = c("#66C2A5","#FC8D62"),notch=T)#画出凹口,可比较上下数据多少
boxplot(len ~ supp dose, data = ToothGrowth,
col = c("#66C2A5","#FC8D62"),horizontal = T)
t.test(ToothGrowth$len[ToothGrowth$supp == 'OJ'& ToothGrowth$dose == 0.5],
ToothGrowth$len[ToothGrowth$supp == 'VC'& ToothGrowth$dose == 0.5])
带凹口的箱线图
二、小提琴图
代码语言:javascript复制library(vioplot)
vioplot(len ~ supp dose, data = ToothGrowth,
col = c("#66C2A5","#FC8D62"))
vioplot(len ~ supp dose, data = ToothGrowth,
col = c("#66C2A5","#FC8D62"),
main = 'OJ vs VC',
xlab = 'Supp and Dose',
ylab = 'Tooth Length')
example(vioplot)
par(mfrow=c(1,1))#恢复案例后的绘图区域布局
写在最后:有时间我们会努力更新的。大家互动交流可以前去论坛,地址在下面,复制去浏览器即可访问,弥补下公众号没有留言功能的缺憾。原地址暂未启用(bioinfoer.com)。
代码语言:javascript复制sx.voiceclouds.cn
有些板块也可以预设为大家日常趣事的分享等,欢迎大家来提建议。