Tutorials › Introduction to Statistics › Mosaic Plots as Area Displays

Graphs for Categorical Data · Tutorial 115 of 996

Mosaic Plots as Area Displays

See how mosaic plot widths, heights, and areas translate a two-way table into a display you can read and compare accurately.

Beginner 9 min read

What You'll Learn

  • Explain how a mosaic plot represents the counts in a two-way table.
  • Relate strip widths to marginal totals and rectangle heights to conditional proportions.
  • Identify the two category values represented by any rectangle.
  • Verify that a rectangle’s area represents its share of the total count.
  • Compare plots with different category orderings or group sample sizes.

Why Read a Mosaic Plot?

A two-way table organizes counts for combinations of two categorical variables. A mosaic plot turns that table into adjacent rectangles: each rectangle corresponds to one combination of categories, and its area is proportional to the count for that combination. This lets you see the joint distribution as a whole while also comparing the composition of groups.

The key is to read both dimensions of the rectangles. In the common layout used here, the categories of one variable form horizontal strips, and the categories of the other variable divide each strip vertically. Strip widths show how common the first variable’s categories are; the heights within each strip show the conditional proportions of the second variable. The resulting rectangle areas represent the two-way table counts.

Definition: A mosaic plot is a display of a two-way table in which each cell is represented by a rectangle. When the total plotting area is scaled to 1, the area of the rectangle for cell \((i,j)\) equals \(n_{ij}/n\), where \(n_{ij}\) is that cell’s count and \(n\) is the grand total. In the layout used here, the width of category \(i\) is its marginal proportion, and the height for category \(j\) within that strip is the conditional proportion of \(j\) among observations in category \(i\).

From a Two-Way Table to Rectangles

Suppose the first variable has categories \(A_1,\ldots,A_r\), and the second has categories \(B_1,\ldots,B_c\). Let \(n_{ij}\) be the count in the cell for \(A_i\) and \(B_j\), let \(n_{i+}\) be the total for category \(A_i\), and let \(n\) be the grand total. The row total \(n_{i+}\) determines the width of strip \(i\). Within that strip, cell \(ij\) takes a fraction \(n_{ij}/n_{i+}\) of its height.

$$ \text{width of strip }i=\frac{n_{i+}}{n}, \qquad \text{height of cell }ij=\frac{n_{ij}}{n_{i+}} $$

The dimensions work together. Multiplying the width by the cell’s height gives its area:

$$ \text{area of cell }ij = \frac{n_{i+}}{n}\times\frac{n_{ij}}{n_{i+}} = \frac{n_{ij}}{n} $$

This is the central reading rule: rectangle area encodes the cell’s share of all observations. The widths and heights also show how the table’s margins and within-group proportions are built into the display. Because strip widths vary, two rectangles with the same height need not have the same area. Because heights are conditional on the strip, they should not be read as overall proportions unless the strip itself represents the full data set.

Worked Example: Turning a Small Survey Table into Areas

In a hypothetical survey, 80 students report whether they live in a dorm or commute, and whether they usually study in a quiet place or with a group. The table is:

ResidenceQuiet placeWith a groupTotal
Dorm181230
Commute203050
Total384280

Put residence along the horizontal dimension, so there is one strip for dorm residents and one for commuters. Their widths are their marginal proportions:

$$ \text{Dorm width}=\frac{30}{80}=0.375, \qquad \text{Commute width}=\frac{50}{80}=0.625 $$

Within the dorm strip, the quiet-place height is \(18/30=0.600\), and the group-study height is \(12/30=0.400\). Within the commuter strip, those heights are \(20/50=0.400\) and \(30/50=0.600\), respectively. Each rectangle’s area is the product of its strip width and its within-strip height. For example:

$$ \begin{aligned} \text{Dorm and quiet area} &= 0.375\times0.600=0.225=\frac{18}{80},\\ \text{Commute and group area} &= 0.625\times0.600=0.375=\frac{30}{80}. \end{aligned} $$

Thus, the dorm-and-quiet rectangle represents 18 of the 80 students, while the commute-and-group rectangle represents 30 of the 80. The quiet-place rectangle is taller in the dorm strip than in the commuter strip, showing that the conditional quiet-place proportion is higher among dorm residents in this sample.

Identifying the Categories in a Region

Every rectangle represents a pair of category values, one from each variable. To name a region correctly, trace it in both directions: first identify the strip’s category, then identify the segment within that strip. For example, in the table above, a rectangle in the dorm strip and the quiet-place segment represents students who both live in a dorm and usually study in a quiet place. It is not a rectangle for all quiet-place students; that group also includes quiet-place commuters.

Labels are essential. A mosaic plot may use color or shading to distinguish the categories within strips, but colors alone do not identify their meaning. Read the legend, category labels, and any axis labels before interpreting the shapes. If a plot is drawn with the variables’ roles reversed, the strips and segments change direction; the category pair represented by each region does not.

Worked Example: Reading a Rectangle and Its Conditional Proportion

Use the survey table above. Suppose a rectangle is in the commuter strip and corresponds to “quiet place.” Identify its category pair, calculate its area, and distinguish the area from its height.

Category pair. The strip is “commute,” and the segment is “quiet place.” The rectangle represents students who commute and usually study in a quiet place. Its cell count is 20.

Width and height. The commuter strip has width \(50/80=0.625\). The quiet-place segment within that strip has height \(20/50=0.400\), the proportion of commuters in this sample who usually study in a quiet place.

Area. Multiplying the dimensions gives \(0.625\times0.400=0.250\). Directly from the cell count, \(20/80=0.250\) of all surveyed students are commuters who usually study in a quiet place. The height, 0.400, is conditional on being a commuter; the area, 0.250, is the share of the full sample in that cell.

These values answer different questions. The height compares study habits within commuters, while the area gives the joint group’s share of the entire sample.

Why the Area Rule Works

A mosaic plot is not just a collection of rectangles sized by eye. Its construction makes the cell areas agree with the table. The following short derivation shows why.

1
Scale each strip by its marginal total.
For category \(A_i\), give the strip width \(n_{i+}/n\). The widths across all strips sum to 1 because \(\sum_i n_{i+}=n\).
2
Divide the strip by the conditional proportions.
Within strip \(i\), give cell \(ij\) height \(n_{ij}/n_{i+}\). These heights sum to 1 because \(\sum_j n_{ij}=n_{i+}\).
3
Multiply the dimensions.
The cell area is \((n_{i+}/n)(n_{ij}/n_{i+})=n_{ij}/n\). Thus every cell’s area is exactly its proportion of the grand total, and all cell areas together sum to 1.

This argument also explains why the display represents both marginal and conditional information. The entire strip width corresponds to a row total, while the height division within that strip corresponds to the row’s conditional proportions. The area combines them to recover each joint proportion.

Changing the Variable Order

A two-way table can be displayed with either variable defining the strips. Changing the order changes which quantities are easiest to compare: one layout emphasizes the conditional distribution of study place among residence groups, and the other emphasizes residence within study-place groups. The underlying cell counts and area proportions remain the same.

Worked Example: Reversing the Survey Plot’s Layout

Use the same 80-student survey, but now put study place along the horizontal dimension. The quiet-place strip has width \(38/80=0.475\), and the group-study strip has width \(42/80=0.525\). Within the quiet-place strip, the residence proportions are:

$$ \text{Dorm given quiet}=\frac{18}{38}\approx0.474, \qquad \text{Commute given quiet}=\frac{20}{38}\approx0.526 $$

Within the group-study strip, they are:

$$ \text{Dorm given group}=\frac{12}{42}\approx0.286, \qquad \text{Commute given group}=\frac{30}{42}\approx0.714 $$

For example, the quiet-and-dorm rectangle has width \(0.475\) and height \(18/38\). Its area is approximately \(0.475\times0.474=0.225\), which agrees with \(18/80=0.225\). The same region in the reversed layout still represents the same 18 students; it simply appears in a different strip-and-segment arrangement.

The residence-first layout makes it straightforward to compare the proportion studying quietly among dorm residents with the proportion among commuters: \(18/30=0.600\) versus \(20/50=0.400\). The study-place-first layout instead makes it straightforward to compare the residence composition of quiet-place and group-study students. Choose the reading that matches the question, and always use the labels to determine which conditional proportions are being shown.

Comparing Groups with Different Sample Sizes

When a mosaic plot includes groups with unequal totals, their strips have unequal widths. This is not a defect: the width records how much of the full sample belongs to each group. The segment height within a strip can still be compared across groups to compare conditional proportions. Areas, meanwhile, reflect both group size and the within-group proportion.

Worked Example: Equal Counts, Different Group Proportions

In a separate hypothetical campus survey, 40 students from Campus A and 60 students from Campus B report whether they are satisfied with a service. Campus A has 24 satisfied and 16 not satisfied; Campus B has 24 satisfied and 36 not satisfied. Put campus along the horizontal dimension.

The campus strip widths are \(40/100=0.400\) for A and \(60/100=0.600\) for B. The satisfied heights within the strips are \(24/40=0.600\) for A and \(24/60=0.400\) for B. Therefore, satisfaction is more common within the surveyed Campus A group, even though the two campuses have the same number of satisfied respondents.

The satisfied areas are \(0.400\times0.600=0.240\) for A and \(0.600\times0.400=0.240\) for B. Each rectangle represents 24 of the 100 respondents. Equal areas here reflect equal counts, while the different heights reflect different within-campus proportions. The plot describes these respondents; by itself, it does not establish why the responses differ or whether the difference extends beyond them.

Common Mistakes

  • Reading height as an overall proportion. A height within one strip is conditional on belonging to that strip. To get the share of the whole sample in the cell, use the rectangle’s area.
  • Comparing areas when the question is about within-group proportions. Areas depend on both the group total and the conditional proportion. Compare segment heights across strips to compare the proportions within groups.
  • Assuming a wider strip means a larger conditional proportion. Width represents the group’s share of the full sample, not the fraction of that group in a segment.
  • Naming a rectangle using only one category. Each cell region represents a combination of one category from each variable. Read both the strip and the segment labels.
  • Assuming the plot’s orientation determines a different table. Reversing the variables changes the arrangement and the conditional proportions shown directly, but not the cell counts or cell areas.
Key takeaway: In a mosaic plot, identify the strip category and the within-strip category to name a cell. Read its width as a marginal proportion, its height as a conditional proportion, and its area as the cell count divided by the grand total.

Check Your Understanding

Use the definitions and reading rules in this tutorial to answer the questions.

  1. A strip contains 25% of all observations. What does its width represent, and what does the full strip’s area represent?
  2. A segment is 0.30 of the height of its strip. What conditional proportion does that height show?
  3. In the 80-student survey, what category pair does the cell with count 12 represent, and what fraction of all respondents does its area represent?
  4. Why can two rectangles have equal areas but different heights? Give the campus survey example’s satisfied rectangles as an illustration.
  5. If the variables are reversed in a mosaic plot, what changes in the display and what remains unchanged?