找回密码
 注册
查看: 3288|回复: 2

R 绘制趋势性检验结果图 实例操作

[复制链接]
发表于 2013-3-22 15:11:20 | 显示全部楼层 |阅读模式
data1和data2是趋势性检验所得结果。
根据结果画图说明

  1. data1<-sample(1:50,18)
  2. data2<-sample(51:10,18)

  3. data1<- matrix(data1,nrow=3)
  4. data2<- matrix(data2,nrow=3)

  5. datab<-round(sapply(1:6,function(x) data1[,x]/sum(data1[,x])),digits=2)*100
  6. ldatab<-round(sapply(1:6,function(x) data2[,x]/sum(data2[,x])),digits=2)*100

  7. colnames(datab)<-rep(c("非胖子","胖子"),3)
  8. colnames(ldatab)<-rep(c("非胖子","胖子"),3)


  9. par(mfrow=c(2, 3))
  10. barplot(datab[,1:2],sub ="P=0.085 for trend",space=1,main="腰围",axes=F);
  11. axis(1,labels=F,at=c(0,9))
  12. axis(2,at=seq(from=0,to=100,by=20),labels=c("0%","20%","40%","60%","80%","100%"))

  13. barplot(datab[,3:4],sub ="P=0.81 for trend",space=1,main="臀围",axes=F);
  14. axis(1,labels=F,at=c(0,9))
  15. axis(2,at=seq(from=0,to=100,by=20),labels=c("0%","20%","40%","60%","80%","100%"))

  16. barplot(datab[,5:6],sub ="P=0.0321 for trend",space=1,main="体重",axes=F);
  17. axis(1,labels=F,at=c(0,9))
  18. axis(2,at=seq(from=0,to=100,by=20),labels=c("0%","20%","40%","60%","80%","100%"))

  19. barplot(ldatab[,1:2],sub ="P=0.0091 for trend",space=1,main="腰围",axes=F);
  20. axis(1,labels=F,at=c(0,9))
  21. axis(2,at=seq(from=0,to=100,by=20),labels=c("0%","20%","40%","60%","80%","100%"))

  22. barplot(ldatab[,3:4],sub ="P=0.0501 for trend",space=1,main="臀围",axes=F);
  23. axis(1,labels=F,at=c(0,9))
  24. axis(2,at=seq(from=0,to=100,by=20),labels=c("0%","20%","40%","60%","80%","100%"))

  25. barplot(ldatab[,5:6],sub ="P=0.0101 for trend",space=1,main="体重",axes=F);
  26. axis(1,labels=F,at=c(0,9))
  27. axis(2,at=seq(from=0,to=100,by=20),labels=c("0%","20%","40%","60%","80%","100%"))

复制代码
trend.png



以上数据纯属随机所得,只做实践例子参考。不代表真是结果。
回复

使用道具 举报

发表于 2013-9-7 10:30:59 | 显示全部楼层
学习了,谢谢b版的实例,俺们这些新手就喜欢看这个,嘎嘎,先MARK一个,慢慢看
回复 支持 反对

使用道具 举报

发表于 2013-11-24 18:12:54 | 显示全部楼层

data1和data2是趋势性检验所得结果这个怎么来理解啊
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-24 11:12 , Processed in 0.031272 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表