R 図の重ね合わせ

Rで図を重ね合わせる場合は…
par(new=T)で図を重ね合わせる.


add=T(もしくはTRUE)の引数を使うことで重ねることができる.
ただし,add=Tは使えないことがあるのでそんなときはpar(new=T)を使う.


例:


> plot(dat1,dat2,type="l",bty="L",xlim=c(0,300),ylim=c(0,1200))
> par(new=T)
> plot(dat3,dat4,type="l",bty="L",xlim=c(0,300),ylim=c(0,1200))
x軸やy軸は揃えておかないと,ズレて重なってしまうので注意.

plotCIでは…

> plotCI(...............)
> plotCI(..............., add=T)

なお,plotCIを使う時はgplotsパッケージが必要.

コメント