![](/img/trans.png)
[英]Lattice: Plotting two lines with different scale and axes in the same panel
[英]aggregate and plotting histograms with the same scale and axes
我有这样的名为PACKS的数据:
error CENTRE_B
-13 1104
-13 1303
-13 1303
2 1204
2 1403
2 1403
2 1403
2 1502
3 1503
我的目的是比较分布。 我想绘制CENTRE_B每个值的误差直方图。 问题在于直方图必须处于相同的比例。
我尝试了这个:
new.par <- par(mfrow=c(5, 5))
histograms = aggregate(error ~ CENTRE_B, PACKS, hist)
这将绘制直方图。 但是,我不知道如何向hist传递额外的参数(breaks = c(-80,80))。
另一个问题是直方图似乎是2x45维的data.table,因此它不包含直方图。 因此,我不知道如何自动更改参数。
在此先感谢您的任何建议。
忘记aggregate
。 只需使用split
并做一个简单的for循环即可。 然后,您可以将所有args直接输入hist
。
new=split(PACKS$error,PACKS$CENTRE_B)
for(i in 1:length(new))
hist(new[[i]],main="Some fancy title", sub="don't forget you can use paste to change the title between loops")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.