将自定义值的箱图放入同一帧中

时间:2016-01-18 22:08:02

标签: r

我们说我有这些数据:

# (Please note these are statistical summaries, not actual data sets)
x1  = list(stats = matrix(c(1,2,3,4,5)), n = 5)
x2  = list(stats = matrix(c(4,5,6,7,8)), n = 10)
x3  = list(stats = matrix(c(3,4,5,6,7)), n = 15)
x4  = list(stats = matrix(c(2,3,4,5,6)), n = 20)
x5  = list(stats = matrix(c(5,6,7,8,9)), n = 25)

xx1 = list(stats = matrix(c(1.5,2,3,4,4.5)), n = 5)
xx2 = list(stats = matrix(c(4.5,5,6,7,7.5)), n = 10)
xx3 = list(stats = matrix(c(3.5,4,5,6,6.5)), n = 15)
xx4 = list(stats = matrix(c(2.5,3,4,5,5.5)), n = 20)
xx5 = list(stats = matrix(c(5.5,6,7,8,8.5)), n = 25)

我希望使用我自己的统计摘要来绘制这些箱图:

par(mfrow = c(2,5))
bxp(x1, ylim = c(0,10))
bxp(x2, ylim = c(0,10))
bxp(x3, ylim = c(0,10))
bxp(x4, ylim = c(0,10))
bxp(x5, ylim = c(0,10))

bxp(xx1, ylim = c(0,10))
bxp(xx2, ylim = c(0,10))
bxp(xx3, ylim = c(0,10))
bxp(xx4, ylim = c(0,10))
bxp(xx5, ylim = c(0,10))

这是我得到的: lots-of-boxplots.jpeg enter image description here 问题:

1)目前,每个地块都有自己的y轴。如何使每个都有自己的轴?

2)如何通过将顶行标记为" x值"来为整个图像提供2个y轴标签。并且底行为" xx值"?

3)如何通过将第一列标记为"组1和#34;,将第二列标记为"组2和#34;等等,为整个图像提供5个x轴标签?

1 个答案:

答案 0 :(得分:1)

你这里有点混乱

tail -c1 file | read -r _ || echo >> file

enter image description here