[R] boxplot and xlim confusion?

Petr Pikal petr.pikal at precheza.cz
Thu Sep 29 12:35:46 CEST 2005


Hi Karin

I did not have seen any answer for your question yet so here is a 
try.

I gues you want the horizotal layout or your boxplot.

boxplot(split(rnorm(30), rep(1:3, each=10)), horizontal =T, 
names=letters[1:3])

boxplot(split(rnorm(30), rep(1:3, each=10)), horizontal =T, 
names=c(NA,"b",NA))

So this is closest what I could dig from your text.

***reproducible*** example would by good starting point what you want 
and was not able to produce.

HTH
Petr




On 28 Sep 2005 at 15:50, Karin Lagesen wrote:

To:             	r-help at r-project.org
From:           	Karin Lagesen <karin.lagesen at medisin.uio.no>
Date sent:      	Wed, 28 Sep 2005 15:50:06 +0200
Subject:        	[R] boxplot and xlim confusion?

> 
> 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","lightblu
> e","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/
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list