# four fold plots based on Frinedly's 2000 Visualizging Categorical Data values = c(1198, 557, 1493, 1278) dim(values) = c(2,2) rownames(values) = c("Male", "Female") colnames(values) = c("Admitted", "Rejected") fourfoldplot(values[,]) data(UCBAdmissions) x <- aperm(UCBAdmissions, c(2, 1, 3)) dimnames(x)[[2]] <- c("Yes", "No") names(dimnames(x)) <- c("Sex", "Admit?", "Department") fourfoldplot(x[,,]) # Mosaic plot based on Frinedly's 2000 Visualizging Categorical Data # Note that values are not exactly what is in his book. Buy it to get the real values. values = c(6, 30, 15, 17, 16, 55, 15, 11, 21, 85, 18, 95, 69, 120, 27, 8); values = matrix(values, nrow = 4, byrow=TRUE) rownames(values) = c("Green", "Hazel", "Blue", "Brown") colnames(values) = c("Black", "Brown", "Red", "Blond") mosaicplot(values, shade = TRUE) # Association plot based on Frinedly's 2000 Visualizging Categorical Data # Note that values are not exactly what is in his book. Buy it to get the real values. values = c(6, 30, 15, 17, 16, 55, 15, 11, 21, 85, 18, 95, 69, 120, 27, 8); values = matrix(values, nrow = 4, byrow=TRUE) rownames(values) = c("Green", "Hazel", "Blue", "Brown") colnames(values) = c("Black", "Brown", "Red", "Blond") marg <- margin.table(values, c(1, 2)) assocplot(marg, main = "Relation between hair and eye color")