# Rebuild the manuscript figures

This folder contains the complete R source shown in the tutorial's [Figure Gallery](../../downloads.html#figure-gallery), plus the aggregate values and extracted coordinates used by manuscript Figures 2–4. Manuscript Figure 1 is conceptual. It is explained in the Framework lesson and is not recreated in R. Run the three analysis-figure scripts from the repository root. Each recreates a PNG and PDF in `tutorial/figures/figure-gallery/`.

```sh
Rscript --vanilla tutorial/downloads/figure-gallery/make-figure-2.R
Rscript --vanilla tutorial/downloads/figure-gallery/make-figure-3.R
Rscript --vanilla tutorial/downloads/figure-gallery/make-figure-4.R
```

Figures 2 and 3 use `ggplot2` and `patchwork`; Figure 2 also uses `ggrepel`. Figure 4 uses `ggplot2` and `patchwork`. The scripts check the expected trait counts, summary rows, interval ordering, and retained-refit counts before plotting.

Figures 2–4 redraw **saved estimates**, not fresh analyses. Their CSV inputs contain aggregate point estimates and percentile limits, or extracted ordination scores and loadings. The scripts do not fit either model package or rerun the parametric bootstrap. The charr and dog lessons show the model-fitting and extraction workflows separately. In particular, the ordination inputs have already been rotated and the plotting scripts do not perform varimax rotation.

The interval tables use archived paired parametric-bootstrap campaigns: 1,066 retained paired refits for charr and 1,095 for dogs. The intervals are conditional on the selected model and numerical retention rule; their nominal coverage has not been established. The figure scripts read the saved, unrounded endpoints and use them for the displayed asterisks.

The full input list, row counts, hashes, and source descriptions are in [`data/manifest.csv`](data/manifest.csv). `build_manifest.py` regenerates that manifest after an input changes. `make-figure-4.R` uses derived dog scores with randomized source IDs removed. Those rows remain pseudonymous study data, and any external distribution remains subject to the data-use and prepublication review described in [`../DATA-AVAILABILITY.md`](../DATA-AVAILABILITY.md).
