[R] multiple mosaic plots layout

baptiste auguie baptiste.auguie at googlemail.com
Mon May 2 02:06:50 CEST 2011


Unfortunately, it seems that vcd doesn't return grobs but draws
directly to the device, which prevents a concise solution. You could
try the following,

library(gridExtra)
library(vcd)
data("Titanic")

p = grid.grabExpr(mosaic(Titanic))
grid.arrange(p, p, p, ncol=2)

Or, more versatile but also more verbose,

pushViewport(...)
mosaic(...)
upViewport()
pushViewport(...)
mosaic(...)
upViewport()
etc..

HTH,

baptiste

On 2 May 2011 11:32, Neuwirth Erich <erich.neuwirth at univie.ac.at> wrote:
> I would like to display multiple mosaic plots from vcd (not defined by a model but derived from different data sets)
> side by side.
> Neither par(mfrow=...)
> nor layout seem to allow to arrange multiple mosaic plots in a grid.
> Is there an easy way of arranging mosaics in a grid?
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list