Re: [R] plain shading (not residuals) in mosaic plot

From: Achim Zeileis <>
Date: Thu 20 Jul 2006 - 23:41:12 EST

On Thu, 20 Jul 2006, Kie Zuraw wrote:

> Thank you very much, Gabor Grothendieck and Muhammad Subianto. Both of
> these work perfectly. I think I was misunderstanding gp and gpar()
> before. Again, thank you both.

Two further additions to this:

> > Maybe like this:
> > mosaic(allmorph, direction = "v", pop = FALSE,
> > gp=gpar(fill=c(grey(0.8),grey(0.4))))

This works because the fill pattern is expanded along the "dependent" variable (last splitting variable) in the plot. In general you can supply arbitrary patterns by supplying a fill pattern of the same dimension as the original table, e.g.,

  mycol <- allmorph

  mycol[,1] <- grey.colors(2)[2]
  mycol[,2] <- grey.colors(2)[1]
  mycol[1,2] <- grey(0)

  mosaic(allmorph, split_vertical = TRUE, gp = gpar(fill = mycol))

Furthermore, several high-level functions producing similar pictures are available, in particular

  doubledecker(allmorph, col = grey.colors(2)[2:1])



Note that the latter is not based on strucplot() and hence can not be labeled with the labeling functions for mosaic().

Z mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu Jul 20 23:47:41 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 21 Jul 2006 - 00:20:19 EST.

Mailing list information is available at Please read the posting guide before posting to the list.