Box和Whisker图表显示以下信息:max,min,mean,75th百分位数,第25百分位数.如果我有这些信息,我可以绘制相应的B&W图吗?
我有这个名为TP.df的数据框:
pb1 ag1 pb2 ag2 pb3 ag3
Nb 498 498 85 85 68 68
Min 0 0 0 0 0 0
Max 1.72 461 2.641 260.8 0.3 144
Mean 0.06 19.2 0.15 35.35 0.02 9.11
75_p 0.06 20 0.08 33 0.02 8
25_p 0.01 10 0 14 0.01 4
Run Code Online (Sandbox Code Playgroud)
文件:
,pb1,ag1,pb2,ag2,pb3,ag3
Nb,498,498,85,85,68,68
Min,0,0,0,0,0,0
Max,1.72,461,2.641,260.8,0.3,144
Mean,0.06,19.2,0.15,35.35,0.02,9.11
75_p,0.06,20,0.08,33,0.02,8
25_p,0.01,10,0,14,0.01,4
Run Code Online (Sandbox Code Playgroud)
如何获得相应的Box和Whisker图:
pb1,ag1,pb2,ag2,pb3,ag3 0到max(TP.df[Max,])用于bxp从五个数字摘要中制作箱线图.
这会做你想要的那种吗?
testdata=data.frame(R1=c(0,5,3,2,4),R2=c(1,7,3,2.8,6))
o=c(1,5,3,4,2) # the rows in increasing order
bxp.data=list(stats=data.matrix(testdata[o,]),n=rep(1,ncol(testdata)))
# the n=... parameter doesn't affect the plot, but it still needs to be there
bxp(bxp.data)
Run Code Online (Sandbox Code Playgroud)
您可以使用标准图形参数(请参阅参考资料help(par))来标记轴并使其看起来很漂亮.
(注意:行号是一个因为问题是在我发布这个答案之后编辑的.我将保留答案,使其与前两个评论相符.)