Mosaic Plot

This is a Plot

  • it's a visualization of information from Contingency Tables
  • it's similar to a Bar Chart, but shows more information
  • uses areas to represent this information


R

Add data

library(openintro)
data(email)

One variable

tab1 = table(email$number)
mosaicplot(tab1, col=c('yellow2', 'skyblue2', 'red'),
           main='Numbers in emails')

5d63a91dd2be45e499aeacedb579328e.png


tab2 = table(email$number, email$spam)
mosaicplot(tab2, col=c('yellow2', 'skyblue2'),
           main='Numbers in emails vs spam/not spam')

afd8ce0b7f3d4f71ad86a07b56d3a098.png


Sources