Maybe like this: mosaic(allmorph, direction = "v", pop = FALSE, gp=gpar(fill=c(grey(0.8),grey(0.4))))
Best, Muhammad Subianto On 7/19/06, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > If you look at ?mosaic the ... argument says it gets passed to strucplot and > looking at ?strucplot we see it accepts a gp= arg so try this (same > as your plus gp= arg): > > cols <- c(grey(0.8),grey(0.4)) > mosaic(allmorph, direction = "v", pop = FALSE, gp = list(col = cols)) > > On 7/19/06, Kie Zuraw <[EMAIL PROTECTED]> wrote: > > Hello. I've been using R for a couple of months and enjoying it a lot. > > This is my first post to R-help. > > > > I'm using the vcd package to make mosaic plots with labels on the tiles > > indicating the number of items in each cell. > > > > For example, I've made this plot: > > > > > > > allmorph<-structure(c(10, 26, 17, 100, 70, 97, 253, 430, 185, 177, > > > 25, 1), .Dim = as.integer(c(6, 2)), .Dimnames = > > > structure(list(Stem.initial.obstruent = c("p", "t,s", > > > "k","b","d","g"),Subst.behavior=c("unsubstituted","substituted")), > > > .Names = c("Stem-initial obstruent","Behavior according to > > > dictionary")), class = "table") > > > mosaic(allmorph,direction="v",pop=FALSE) > > > labeling_cells(text=allmorphs,margin=0)(allmorph) > > > > > > So far so good. What I can't figure out how to do--after searching > > through the vcd documentation > > (http://cran.r-project.org/doc/packages/vcd.pdf), Googling, and > > checking the r-help archive--is how to shade the tiles according to > > their values for the variables rather than to reflect residuals. That > > is, I want all the tiles at the bottom, whose value for the x-axis > > variable is "substituted", to be dark grey, and those at the top, in > > the "unsubstituted" category, to be light grey. > > > > I know how to do it with mosaicplot(): > > > > > mosaicplot(morphs3,color=c(grey(0.8),grey(0.4))) > > > > ...but this doesn't work with mosaic(): the command > > "mosaic(morphs3,color=c(grey(0.8),grey(0.4)))" yields a plot with all > > tiles the same color. And conversely, I can't find a way to use > > mosaicplot() and add numeric labels to the tiles--without much hope of > > success, I tried combining mosaicplot() with labeling_cells(), but, > > unsurprisingly, it didn't work: > > > > > mosaicplot(morphs3,color=c(grey(0.8),grey(0.4)),pop=FALSE) > > Warning message: > > extra argument(s) 'pop' will be disregarded in: > > mosaicplot.default(morphs3, color = c(grey(0.8), grey(0.4)), > > > labeling_cells(text=morphs3,margin=0)(morphs3) > > Error in downViewport.vpPath(vpPathDirect(name), strict, recording = > > recording) : Viewport 'cell:Stem-initial obstruent=p,Behavior > > according to dictionary=unsubstituted' was not found > > > > > > Does anyone know how to get both the shading I want and the labels I > > want, whether with mosaic(), with mosaicplot(), or in some other way? > > > > Thanks for your attention. > > > > -Kie Zuraw > > > > ______________________________________________ > > R-help@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 > > and provide commented, minimal, self-contained, reproducible code. > > > > ______________________________________________ > R-help@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 > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@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 and provide commented, minimal, self-contained, reproducible code.