Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

mosaic-plot

data("HairEyeColor")
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.

like image 872
Phil Avatar asked Jan 06 '23 08:01

Phil


1 Answers

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

Or...

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

enter image description here

like image 154
Cyrus Mohammadian Avatar answered Jan 13 '23 10:01

Cyrus Mohammadian