Jenny
Jenny

Reputation: 265

Change the size of labels in mosaic function, R

I have a mosaic, and I want to change the size of the character of the labels. What can I do?

library(vcd)
tbl<-structable(GWage~Gender,data=dat)

mosaic(tbl,shade=TRUE, legend=TRUE)

Upvotes: 0

Views: 3208

Answers (1)

aiatay7n
aiatay7n

Reputation: 182

Updated for Mosaic()

mosaic(UCBAdmissions, sort = 3:1, 
       gp_varnames = gpar(fontsize = 14, fontface = 1),
       gp_labels = gpar(fontsize = 10),
       main = "Student admissions at UC Berkeley")
?labelings

See ?labelings & play around with the font sizes till you get what you want. You should probably post a tibble /mini-extract of your data to make it easily reproducible.

you may be able to do more with mosaicplot()? Did you try

cex.axis = 0.7   # or whatever size works for your plot?
#Example:
table1 <- table(airquality$Temp[1:7], airquality$Month[1:7])
mosaicplot(table1,
           main = "Example",
           xlab = "Y",
           ylab = "X",
           las = 2,
           border = "chocolate",
           cex.axis = 0.7,
           shade = TRUE)

Upvotes: 1

Related Questions