[R] Controling width of boxes in boxplots

Henrique Dallazuanna wwwhsd at gmail.com
Fri Feb 15 14:18:25 CET 2008


Try this:

x <- sample(5, 100, rep=T)
y <- rnorm(100)

plot(x,y, xlim=c(min(x)-.5, max(x)), ylim=c(min(y), max(y)+1))
boxplot(y, pars=list(boxwex=0.3), at=min(x)-.5, add=T)
boxplot(x, pars=list(boxwex=0.3), at=max(y)+1, add=T, horizontal=T)


On 15/02/2008, Marcin Kozak <nyggus at gmail.com> wrote:
> Hi,
>
>  I want to add boxplots to a scatterplot:
>
>  plot(x,y, xlim=c(80,120),ylim=c(80,120))
>  boxplot(y,add=TRUE,at=118)
>  boxplot(x,add=TRUE,at=118,horizontal=TRUE)
>
>  How can I control the width of the boxes (say, I'd like them to be of
>  width 3 in the variables' scales). I've tried the "width" parameter
>  but failed.
>
>  Thanks in advance,
>  Marcin
>
>  ______________________________________________
>  R-help at r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>  and provide commented, minimal, self-contained, reproducible code.
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list