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

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Thu Jul 20 15:41:12 CEST 2006

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().


More information about the R-help mailing list