Phil Phil - 1 year ago 151
R Question

Is it possible to edit the axes labels for a mosaic plot from the vcd package?

mosaic(HairEyeColor, shade = TRUE)

Resulting plot

Are there arguments I can use to change the labels on the margins of the resulting plot above? For instance, I'd like to change "Male" to "M", "Female" to "F", to avoid text encroachment, and make some notes in the title labels.

I can't find anything about editing axis labels in the package's help page.

Answer Source
lnames <- list(Sex = c("M", "F"))
mosaic(HairEyeColor, set_labels=lnames, shade=T)


mosaic(HairEyeColor, set_labels=list(Sex = c("M", "F")), shade=T)

enter image description here