Part of the space between the boxplots is the margin area, you can remove
that.  You can also adjust the width of the box within the plot:

layout(matrix(c(1,2,3), 3, 1, byrow = TRUE), heights=c(0.3,0.3,0.6))
op <- par(mar=c(0,4,0,2)+0.1)
boxplot(rnorm(100), horizontal=TRUE, axes=FALSE, width=1)
boxplot(rnorm(100), horizontal=TRUE, axes=FALSE, width=1)
par(op)
hist(rnorm(100))

What might work even better is to combine your 2 vectors for the boxplots
into a single list, then call the boxplot function only once, this will
give you more control of the spacing within a single plot.

layout(matrix( 1:2, 2, 2),heights=c(1,1))
tmp <- list(  rnorm(100,0,1), rnorm(100, 1, 2) )
boxplot(tmp, horizontal=TRUE, axes=FALSE)
hist(rnorm(100))




On Fri, Feb 22, 2013 at 8:43 PM, philippe massicotte <
pmassico...@hotmail.com> wrote:

> Dear R users.
>
> I'm new with layout and I can't figure how to teak my graphs.
>
> I have the following code:
>
> layout(matrix(c(1,2,3), 3, 1, byrow = TRUE), heights=c(0.3,0.3,0.6))
> boxplot(rnorm(100), horizontal=TRUE, axes=FALSE)
> boxplot(rnorm(100), horizontal=TRUE, axes=FALSE)
> hist(rnorm(100))
>
>
> Is it possible to have the two horizontal boxplot closer to each other?
>
> With regards,
> Phil
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to