Lyndon Walker
2009-Jun-17 04:24 UTC
[R] getting cd_plot in vcd package to work with layout
Hi, I'm trying to get 2x2 (or other layouts) of cd_plot from the vcd package. I have tried the usual commands like layout, par(mfrow...) etc and but cd_plot seems to ignore them and send the plotting window back to 1x1. I have also tried turning off the pop and newpage options in cd_plot but I still can't get multiple cd_plots into a plotting window. Any suggestions would be greatly appreciated. cheers Lyndon [[alternative HTML version deleted]]
Lyndon Walker wrote:> Hi, > I'm trying to get 2x2 (or other layouts) of cd_plot from the vcd package. I > have tried the usual commands like layout, par(mfrow...) etc and but cd_plot > seems to ignore them and send the plotting window back to 1x1. I have also > tried turning off the pop and newpage options in cd_plot but I still can't > get multiple cd_plots into a plotting window. > > Any suggestions would be greatly appreciated.This is because cd_plot() uses the grid framework rather than the R base graphics system. Hence use it inside a grid viewport. Example: library("vcd") pushViewport(vp <- viewport(x = 0.25, y = 0.5, w = 0.5, h = 1)) cd_plot(Improved ~ Age, data = Arthritis, newpage=FALSE) popViewport() pushViewport(vp <- viewport(x = 0.75, y = 0.5, w = 0.5, h = 1)) cd_plot(Improved ~ Age, data = Arthritis, newpage=FALSE) popViewport() Uwe Ligges> cheers > Lyndon > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.
Maybe Matching Threads
- vcd package --- change layout of plot
- Help combining cell labelling and multiple mosaic plots
- grid layout scaling viewport width based solely on height
- Problem when combining dotplot() and textplot() using grid
- Problem going back to a viewport with gridBase