A facet plot compares groups by splitting data into multiple subplots, or panels, that share horizontal and vertical axes. Each panel represents a factor or mutually exclusive subset while keeping the visual structure otherwise alike. section 1.2.1 section 9.5.2
Use facet plots to make grouped comparisons while preserving a common visual scale:
- Draw one subplot for every factor or group in the data. section 1.2.1
- Build each panel with the same axes so distributions or counts remain comparable. section 1.2.1
- Use ggplot2's facet_wrap() to arrange panels, customize the number of columns with ncol, and optionally free the scales. section 9.5.2
NBA wins by prior days off
A 25-panel ggplot2 visualization compares home and away win totals for every combination of zero through four prior days off. Horizontal bars encode win totals, panels are arranged by the two days-off variables, and geom_text() adds count labels. Fixed x-axis scales make comparisons consistent; xlim() creates room for labels. section 9.5.2
Inspect a four-panel automobile example that uses ggplot2 visualizations, including a facet plot of miles-per-gallon distributions grouped by cylinders and transmission. section 1.2.1
