Thanks, fixed upstream. David
On 2013-02-08 07:20, Achim Zeileis wrote:
On Fri, 8 Feb 2013, Richard M. Heiberger wrote:require(vcd) mosaic(matrix(1:6, 2, 3), gp=gpar(fill=c("red","gray","blue")), main="three colors in each row") mosaic(matrix(1:3, 1, 3), gp=gpar(fill=c("red","gray","blue")), main="only one color in each row") I anticipated three colors in the second plot. My guess is that there is a matrix subscript without drop=FALSE somewhere on the inside of one of the functions.No, it's more subtle. If the dimension of the data (1, 3) is not the same as that of the fill (NULL), they are recycled along the last dimension (see Section 3 of vignette("strucplot", package = "vcd")). Thus supplying a suitable fill matrix works: mosaic(matrix(1:3, 1, 3), gp = gpar(fill=matrix(c("red","gray","blue"), 1, 3))) David: The reason why Rich's original code does not work properly is that the recycling is not triggered properly. In line 160 of strucplot.R we check if(length(par) < size) which is not the case here and hence the dimension is not added. I think we could do if (length(par) < size | is.null(dim(par))) aperm(array(par, dim = rev(d))) else par That fixes the problem. Best, ZThis is with Package: vcd Version: 1.2-13 Date: 2012-02-19 on version.string R Under development (unstable) (2013-02-02 r61822) platform i386-w64-mingw32 arch i386 os mingw32 system i386, mingw32 [[alternative HTML version deleted]] ______________________________________________ [email protected] 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.
-- Priv.-Doz. Dr. David Meyer Department of Information Systems and Operations WU Wirtschaftsuniversität Wien Vienna University of Economics and Business Augasse 2-6, 1090 Vienna, Austria Tel: +43-1-313-36-4393 Fax: +43-1-313-36-90-4393 HP: http://ec.wu.ac.at/~meyer ______________________________________________ [email protected] 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.

