[英]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.