[R] Quartering a plot() ?
Daniel Malter
daniel at umd.edu
Wed Apr 7 04:52:08 CEST 2010
Hi, nothing customized is effortless. It typically requires a bit of coding
unless you are lucky and somebody has implemented it in some package (you
just have to find the package). But it's not that difficult to do it
yourself. It just requires figuring out where the lines should be placed,
which is easy given that you know where your box is placed. So you just need
to take the terciles of your ylims and xlims and place the lines there.
Below is one approach (probably not the most elegant).
xl=c(-1.5,1.5)
yl=c(0,5)
rect.x=c(1,1,-1,-1,1)
rect.y=c(1.5,3.5,3.5,1.5,1.5)
plot(NULL,xlim=xl, ylim=yl)
lines(rect.x,rect.y, col=c("red"))
denominator=3
nominator=seq(from=1, to=denominator-1, by=1)
seq.rect.x=(max(rect.x)-min(rect.x))*(nominator/denominator)
seq.rect.y=(max(rect.y)-min(rect.y))*(nominator/denominator)
x.coord=min(rect.x)+seq.rect.x
y.coord=min(rect.y)+seq.rect.y
lines(rep(x.coord[1],2),rep(c(min(rect.y),max(rect.y))),col="blue")
lines(rep(x.coord[2],2),rep(c(min(rect.y),max(rect.y))),col="blue")
lines(rep(c(min(rect.x),max(rect.x))),rep(y.coord[1],2),col="blue")
lines(rep(c(min(rect.x),max(rect.x))),rep(y.coord[2],2),col="blue")
HTH,
Daniel
--
View this message in context: http://n4.nabble.com/Quartering-a-plot-tp1753760p1753790.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list