From the course: R for Data Science: Lunch Break Lessons

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

mosaicplot

mosaicplot

- [Instructor] Mosaic plots are a unique plotting tool provided by R, and as everyone knows, extended mosaic displays visualize standardized residuals of a larger linear model for the table by color and outline of the mosaic's tiles. Well, that's a lot to know and it's much easier just to see what's going on. So let's demonstrate. First I'll need to have an array, so I'm going to create three vectors called sample one, sample two, sample three, and then an array called animal planet. And let's take a quick look at animal planet. And what you'll see is that I have three levels inside of animal planet, one of them animals for chickens, one of them animals called fish, and one of them animals called pigs. The name of the rows are Earth and Mars, and the name of the columns are featherweight, light, normal, medium, and heavy. Now to generate a mosaic plot, it's simple. I type in mosaic plot, followed by the name of the array I want to plot. And as simple as that, I now have a mosaic plot…

Contents