Use plot_layout() from patchwork to combine separately created plots into one graphical object. Passing ncol = 2 places the plots side by side, making related summaries easier to compare. section 2.5.5
A typical workflow is:
- Create and store each ggplot object, such as separate mean and median bar charts. section 2.5.5
- Add the plots with + and specify plot_layout(ncol = 2) to arrange them in two columns. section 2.5.5
- Read the resulting composite as a coordinated visual comparison, such as average versus median career win shares. section 2.5.5
Place two NBA charts side by side
After defining p5 as an average-win-shares bar chart and p6 as a median-win-shares bar chart, combine them with: p5 + p6 + plot_layout(ncol = 2). The same pattern combines Milwaukee Bucks charts for points scored and field-goal percentage at each second of a possession: MILp1 + MILp2 + plot_layout(ncol = 2). section 2.5.5 section 8.5.1
p5 + p6 + plot_layout(ncol = 2)
Inspect the complete two-column composition combining the average and median win-share plots. section 2.5.5
