Jul
29
Troubles with cell labels in mosaic plots... and how to solve them.
Today I want to write about a solution to a quite specific problem. Suppose, you want to label cells in your 'vcd' package mosaic plots in a custom way. For example, we might want to use cell labels which indicate "too much" or "too few" cases (given your expected values). Such labels might be "+" and "-" (and maybe "++" and "--" for higher residuals).
We create our custom table:
tab <- rbind(c(450, 230),
c(200, 600))
We create our mosaic plot:
library(vcd)
mosaic(tab, shade = T)
So far, so good.
Now, we want to use custom labels for the cells.
We create our custom table:
tab <- rbind(c(450, 230),
c(200, 600))
We create our mosaic plot:
library(vcd)
mosaic(tab, shade = T)
So far, so good.
Now, we want to use custom labels for the cells.