[R] boxplot and xlim confusion?

Karin Lagesen karin.lagesen at medisin.uio.no
Wed Sep 28 15:50:06 CEST 2005


I have some code as shown below. Basically, I would like three
boxplots to be set next to each other with no ylabels on the two
"inner" plots, and I want the same x axis range on all three. However,
it seems like boxplot does not respect the xlim setting. I've tried
the various ways I thought would work (par, boxplot(...xlim=)) but
none of them seem to work. I then tried plot.window, that did not work.

I also have another curious question for you. With the code below I
tried to call plot.new and then plot.window before each new plot. What
happens then is that the first figure goes on one page whereas the two
others get put on the next page with a nice big gap in the
middle. Does any of you have an explanation for that?

names <- c(
"LSU>, stop",
">LSU, start",
"SSU>, stop",
">SSU, start",
"TSU>, stop",
">TSU, start")
elsustop <- read.table("28s.euk.accuracy.stop.dev")

[skipped lots of read.table, which just reads files with one number on
each line]

par(mfcol=c(1,3))
par(mai = c(0,0,0.5,0.2), omi = c(1,1,1,1))
xaxis = c(-6000,1000)
yaxis = c(0,7)
#plot.new()
#plot.window(xlim=xaxis, ylim=yaxis)
boxplot(alsustop$V1 ,alsustart$V1 ,assustop$V1 ,alsustart$V1 ,atsustop$V1 ,atsustart$V1 ,names=names,col=c("lightblue","orange","lightblue","orange","lightblue","orange") ,horizontal = TRUE, main="ARC", xaxs = "i", las=1)
#plot.new()
#plot.window(xlim=xaxis, ylim=yaxis)
boxplot(blsustop$V1 ,blsustart$V1 ,bssustop$V1 ,blsustart$V1 ,btsustop$V1 ,btsustart$V1 ,col=c("lightblue","orange","lightblue","orange","lightblue","orange") ,horizontal = TRUE, main="BAC", xaxs = "i")
#plot.new()
#plot.window(xlim=xaxis, ylim=yaxis)
boxplot(elsustop$V1 ,elsustart$V1 ,essustop$V1 ,elsustart$V1 ,etsustop$V1 ,etsustart$V1 ,col=c("lightblue","orange","lightblue","orange","lightblue","orange") ,horizontal = TRUE, main="EUK", xaxs = "i")

Karin (sorry if you're getting sick of me..:))
-- 
Karin Lagesen, PhD student
karin.lagesen at medisin.uio.no
http://www.cmbn.no/rognes/




More information about the R-help mailing list