[R] How to make two figures in one plot - package vcd

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Fri Sep 16 19:41:10 CEST 2005


On Fri, 16 Sep 2005 15:59:31 +0000 (UTC) Dieter Menne wrote:

> Muhammad Subianto <subianto <at> gmail.com> writes:
> 
> > I have a problem to make figures with two columns in package vcd.
> > Here an example code I take from "\library\vcd\html\plot.loglm.html"
> > What I need, I want to make two figures in one plot.
> > 
> > library(vcd)
> > oldpar <- par(mfrow=c(1, 2))
> > ## mosaic display for PreSex model
> > data(PreSex)
> > fm <- loglm(~ PremaritalSex * ExtramaritalSex * (Gender +
> > MaritalStatus),
> >              data = aperm(PreSex, c(3, 2, 4, 1)))
> > ## visualize Pearson statistic
> > plot(fm, split_vertical = TRUE)
> > ## visualize LR statistic
> > plot(fm, split_vertical = TRUE, residuals_type = "deviance")
> > par(oldpar)
> ..
> 
> The example worked in the previous version, but David Meyer has
> rewritten the whole package using grid functions.

Exactly and par() sets the base graphics parameters, not grid
parameters. You can use grid.layout() but it's a bit more work than with
par(). Look at 
  example("Ord_plot")
for an illustration.

> Figures are much nicer now, but documentations is a bit on the sparse
> side.

Yes...we're working on a set of vignettes, though. They are almost
done. But then again, we also used to claim that this was the case with
the new (now released) vcd for about two years. It's like the new
Kraftwerk album: it's always coming out `next summer' ;-)

Best,
Z

> I don't have the docs at
> hand currently, but I believe you should looks at strucplot to set the
> layout there, or use grid directly.
> 
> Greetings from an Ex-Cirebonese
> 
> Dieter
> 
> ______________________________________________
> 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
>




More information about the R-help mailing list