[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECRP3J6AHZEB8ZMYK79HDZ":3,"skill-same:01M7ECRP3J6AHZEB8ZMYK79HDZ":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":49},"01M7ECRP3J6AHZEB8ZMYK79HDZ","bio-data-visualization-multipanel-figures",null,"Compose multi-panel publication figures with patchwork, cowplot, gridExtra (R), or matplotlib GridSpec\u002Fsubfigures (Python) including shared axes\u002Flegends\u002Fguides collection, panel labels in Nature\u002FCell convention, and journal-spec sizing. Covers patchwork ≥1.2.0 axes='collect' feature, Type-42 font embedding, and the cairo_pdf save path. Use when composing 2+ subpanels into a single figure for journal submission.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-multipanel-figures\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-data-visualization-multipanel-figures\ndescription: Compose multi-panel publication figures with patchwork, cowplot, gridExtra (R), or matplotlib GridSpec\u002Fsubfigures (Python) including shared axes\u002Flegends\u002Fguides collection, panel labels in Nature\u002FCell convention, and journal-spec sizing. Covers patchwork ≥1.2.0 axes='collect' feature, Type-42 font embedding, and the cairo_pdf save path. Use when composing 2+ subpanels into a single figure for journal submission.\ntool_type: mixed\nprimary_tool: patchwork\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"data-visualization\u002Fmultipanel-figures\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: patchwork 1.2+ (axes='collect' requires this version, released 2024-01-05), cowplot 1.1+, ggplot2 3.5+, matplotlib 3.8+ (subfigures stable since 3.4).\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name`\n- Python: `pip show \u003Cpackage>` then `help(module.function)`\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.\n\n# Multi-Panel Figures\n\n**\"Combine plots into a multi-panel figure\"** -> Arrange individual plots into a single composed figure with consistent sizing, shared legends\u002Faxes, and panel labels (a, b, c) in the Nature\u002FCell convention. The decision space: which composition library (patchwork most modern in R; matplotlib subfigures in Python), how to share legends and axes, and how to size at journal specifications.\n\n- R: `patchwork` (modern; supports axes\u002Fguides collection since 1.2), `cowplot` (older; align_plots), `gridExtra` (basic grid arrange)\n- Python: `matplotlib.gridspec.GridSpec`, `fig.subfigures()` (matplotlib 3.4+)\n\n## The Single Most Important Modern Insight -- Axes Collection Requires patchwork ≥ 1.2.0\n\npatchwork 1.2.0 (released 2024-01-05) added `axes = 'collect'` and `axis_titles = 'collect'` to `plot_layout()`. These collect repeated axes \u002F titles across subplots into a single shared axis label — the same way `guides = 'collect'` (available since patchwork 1.0) collects legends.\n\nWithout this, multi-panel figures with shared axes show redundant labels on every subplot (visually cluttered AND non-Nature compliant). Verify patchwork version is ≥ 1.2.0; older versions silently ignore the `axes` argument.\n\n## patchwork -- Modern R Composition\n\n**Goal:** Compose 4 ggplot objects into a 2×2 panel figure with shared legend, collected axes, and bold panel labels (a, b, c, d) in upper-left of each subplot.\n\n**Approach:** Combine plots with `+`, `\u002F`, `|` operators; apply `plot_layout(guides='collect', axes='collect')` for shared elements; add `plot_annotation(tag_levels='a')` for Nature-style panel labels.\n\n```r\nlibrary(patchwork)\nlibrary(ggplot2)\n\np1 \u003C- ggplot(df, aes(x, y)) + geom_point() + theme_classic()\np2 \u003C- ggplot(df, aes(group, value)) + geom_boxplot() + theme_classic()\np3 \u003C- ggplot(df, aes(x)) + geom_histogram() + theme_classic()\np4 \u003C- ggplot(df, aes(x, y, color = group)) + geom_point() + theme_classic()\n\n# 2x2 grid\nfig \u003C- (p1 + p2) \u002F (p3 + p4) +\n    plot_annotation(tag_levels = 'a',\n                    theme = theme(plot.tag = element_text(face = 'bold', size = 10))) +\n    plot_layout(guides = 'collect',         # share legends\n                axes = 'collect',           # share axes (patchwork >= 1.2.0)\n                axis_titles = 'collect')\n\nggsave('figure1.pdf', fig, width = 180, height = 140, units = 'mm', device = cairo_pdf)\n```\n\n## patchwork Operators\n\n```r\np1 + p2                                     # side-by-side\np1 \u002F p2                                     # vertical stack\n(p1 | p2) \u002F p3                              # mixed: top row two, bottom one\np1 + p2 + p3 + plot_layout(ncol = 3)\np1 + p2 + plot_layout(widths = c(2, 1))     # 2:1 width ratio\n\n# Complex grid via design string\ndesign \u003C- \"\nAAB\nAAB\nCCC\n\"\np1 + p2 + p3 + plot_layout(design = design)\n\n# Inset\np1 + inset_element(p2, left = 0.6, bottom = 0.6, right = 1, top = 1)\n```\n\n## cowplot -- Alternative with Alignment Focus\n\n```r\nlibrary(cowplot)\n\n# plot_grid is the workhorse\ncombined \u003C- plot_grid(p1, p2, p3, p4,\n                       ncol = 2, labels = 'AUTO',         # 'AUTO' = A, B, C, D\n                       label_size = 12, label_fontface = 'bold',\n                       align = 'hv',                       # align horizontally + vertically\n                       rel_widths = c(1, 1), rel_heights = c(1, 1))\n\n# Nested grids\ntop_row \u003C- plot_grid(p1, p2, ncol = 2, labels = c('A', 'B'))\nbottom \u003C- plot_grid(p3, p4, ncol = 2, labels = c('C', 'D'))\ncombined \u003C- plot_grid(top_row, bottom, nrow = 2, rel_heights = c(1, 1.2))\n\nggsave('figure.pdf', combined, width = 180, height = 140, units = 'mm', device = cairo_pdf)\n```\n\ncowplot is older but its alignment behavior is sometimes more reliable than patchwork on edge cases (axes-with-titles of different lengths).\n\n## matplotlib GridSpec (Python)\n\n```python\nimport matplotlib.pyplot as plt\nfrom matplotlib.gridspec import GridSpec\n\nfig = plt.figure(figsize=(180\u002F25.4, 120\u002F25.4), constrained_layout=True)\ngs = GridSpec(2, 3, figure=fig)\n\nax1 = fig.add_subplot(gs[0, 0])\nax2 = fig.add_subplot(gs[0, 1:])         # top right, spans columns 1-2\nax3 = fig.add_subplot(gs[1, :])           # bottom row, spans all columns\n\nax1.scatter(x, y, s=4, rasterized=True)\nax2.plot(x, y)\nax3.bar(cats, vals)\n\n# Panel labels at (-0.15, 1.05) of each axes\nfor ax, lbl in zip([ax1, ax2, ax3], 'abc'):\n    ax.text(-0.15, 1.05, lbl, transform=ax.transAxes,\n            fontsize=10, fontweight='bold', va='top')\n\nfig.savefig('figure.pdf', dpi=300, bbox_inches='tight')\n```\n\n## matplotlib Subfigures\n\n```python\nfig = plt.figure(figsize=(180\u002F25.4, 120\u002F25.4), constrained_layout=True)\nsubfigs = fig.subfigures(1, 2, width_ratios=[2, 1])\n\n# Left subfigure has 2 stacked panels\naxs_left = subfigs[0].subplots(2, 1)\naxs_left[0].plot(x, y)\naxs_left[1].scatter(x, y, rasterized=True)\n\n# Right subfigure has one panel\nax_right = subfigs[1].subplots(1, 1)\nax_right.imshow(matrix)\nsubfigs[1].colorbar(ax_right.images[0], ax=ax_right, shrink=0.5)\n```\n\nSubfigures are stronger than GridSpec for complex compositions because each subfigure has its own constrained_layout.\n\n## Journal Sizing\n\n| Journal | Single col | Double col | Max height |\n|---------|------------|------------|------------|\n| Nature | 89 mm | 183 mm | 247 mm |\n| Cell | 85 mm | 174 mm | 235 mm |\n| Science | 55 mm | 120 mm | 220 mm |\n| PNAS | 87 mm | 178 mm | 225 mm |\n| eLife | 86 mm | 175 mm | ~240 mm |\n\nAlways set explicit units in mm; default inches is the most common source of \"figure too large\" errors.\n\n## Panel Labels — Nature\u002FCell Convention\n\n- **Nature**: lowercase bold serif (a, b, c) in upper-left corner of each panel; 8 pt\n- **Cell**: uppercase bold sans-serif (A, B, C); placed flush left at panel top\n- **Science**: capital bold (A, B, C)\n\n```r\n# patchwork tag_levels for lowercase (Nature)\nplot_annotation(tag_levels = 'a',\n                theme = theme(plot.tag = element_text(face = 'bold', size = 9)))\n# 'A' for uppercase (Cell)\nplot_annotation(tag_levels = 'A')\n# 'i' for roman numerals (sometimes for sub-panels)\n```\n\n```r\n# cowplot\nplot_grid(..., labels = 'AUTO')   # auto uppercase A, B, C\nplot_grid(..., labels = 'auto')   # auto lowercase a, b, c\n```\n\n## Per-Method Failure Modes\n\n### patchwork axes='collect' silently ignored\n\n**Trigger:** Using `plot_layout(axes='collect')` with patchwork \u003C 1.2.0.\n\n**Mechanism:** Older versions silently accept the argument but don't act on it.\n\n**Symptom:** Redundant axes on each subplot; no warning or error.\n\n**Fix:** `packageVersion('patchwork')` must be ≥ 1.2.0. Update with `install.packages('patchwork')`.\n\n### Default ggsave produces non-portable PDF\n\n**Trigger:** `ggsave('out.pdf', fig)` without `device = cairo_pdf`.\n\n**Mechanism:** Default pdf() device produces fonts that journals reject on some systems.\n\n**Symptom:** Submission rejected at automated check; \"non-embedded fonts.\"\n\n**Fix:** Always `device = cairo_pdf`.\n\n### Figure dimensions in inches when mm intended\n\n**Trigger:** `ggsave('out.pdf', fig, width = 180, height = 140)`.\n\n**Mechanism:** Default `units = 'in'`.\n\n**Symptom:** Figure file rejected for being 180 × 140 inches.\n\n**Fix:** Explicit `units = 'mm'`.\n\n### Panel labels not aligned to panel content\n\n**Trigger:** patchwork `plot_annotation(tag_levels)` with subplots of different y-axis label widths.\n\n**Mechanism:** Tag is positioned relative to the plot canvas, including the y-axis label area.\n\n**Symptom:** Labels are at different horizontal positions in each panel.\n\n**Fix:** Either standardize y-label widths (pad with whitespace) OR move tags inside the plotting area: `theme(plot.tag.position = c(0.02, 0.98))`.\n\n### cowplot align='v' fails on plots of different widths\n\n**Trigger:** `plot_grid(p_wide, p_narrow, align = 'v')`.\n\n**Mechanism:** Vertical alignment requires same x-axis widths.\n\n**Symptom:** Plots align at the y-axis but x-axis labels are offset.\n\n**Fix:** Use `align = 'hv'` if both alignments needed; otherwise patchwork's `axes='collect'` handles this more gracefully.\n\n### Shared legend lost in patchwork\n\n**Trigger:** `(p1 + p2) + plot_layout(guides = 'collect')` but p1 and p2 use different scales.\n\n**Mechanism:** `guides='collect'` merges identical guides; different scales produce duplicate (not merged) legends.\n\n**Symptom:** Two legends still appear.\n\n**Fix:** Standardize the scales across subplots (same `scale_color_manual(values=...)`); OR drop one legend via `& theme(legend.position = 'none')` on the redundant plot.\n\n### matplotlib GridSpec with constrained_layout=False\n\n**Trigger:** Older code with `plt.subplots` no constrained_layout; tight_layout fails on colorbars.\n\n**Mechanism:** tight_layout doesn't know about post-hoc colorbars.\n\n**Symptom:** Colorbar overlaps adjacent subplot.\n\n**Fix:** `plt.figure(constrained_layout=True)` and use `fig.add_subplot(gs[...])`. constrained_layout is the default-on choice in matplotlib 3.6+.\n\n## Reconciliation\n\n| Pattern | Cause | Action |\n|---------|-------|--------|\n| patchwork and cowplot align differently | Different alignment algorithms | Try both; cowplot's `align='hv'` and patchwork's `axes='collect'` rarely produce identical results |\n| Panel labels position differs between sessions | Different y-axis label widths | Standardize across panels |\n| Shared legend duplicated | Scales differ across subplots | Use identical scales OR drop legend from N-1 panels |\n\n## Quantitative Thresholds\n\n| Threshold | Value | Source |\n|-----------|-------|--------|\n| Nature single column | 89 mm | Nature figure guidelines |\n| Nature double column | 183 mm | Nature figure guidelines |\n| Body text size | 5-7 pt | Nature rejects outside range |\n| Panel label size | 8 pt bold | Nature convention |\n| patchwork axes='collect' minimum version | 1.2.0 (2024-01-05) | patchwork release notes |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Redundant axis labels per panel | patchwork \u003C 1.2.0 OR axes='collect' not set | Update + add to plot_layout |\n| Non-embedded font rejection | Default ggsave device | `device = cairo_pdf` |\n| Figure 180 in × 140 in | Default units = 'in' | `units = 'mm'` |\n| Panel tags misaligned | Different y-label widths | Standardize or move tag inside |\n| Cowplot vertical alignment fails | Different x-axis widths | Use 'hv' OR switch to patchwork |\n| Two legends instead of shared | Scales differ across subplots | Unify scales |\n| matplotlib colorbar overlaps subplot | No constrained_layout | constrained_layout=True |\n\n## References\n\n- Pedersen TL. 2024. patchwork: the composer of plots. *CRAN package* (v1.2.0 release notes).\n- Wilke CO. 2017. cowplot: streamlined plot theme and plot annotations for ggplot2. *CRAN package*.\n- Hunter JD. 2007. Matplotlib: A 2D graphics environment. *Comput Sci Eng* 9(3):90-95.\n\n## Related Skills\n\n- data-visualization\u002Fggplot2-fundamentals - Individual ggplot objects\n- data-visualization\u002Fmatplotlib-fundamentals - Python equivalent\n- reporting\u002Ffigure-export - DPI \u002F format \u002F journal-spec compliance\n- data-visualization\u002Fcolor-palettes - Consistent palette across subpanels\n","## Version Compatibility\n\nReference examples tested with: patchwork 1.2+ (axes='collect' requires this version, released 2024-01-05), cowplot 1.1+, ggplot2 3.5+, matplotlib 3.8+ (subfigures stable since 3.4).\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name`\n- Python: `pip show \u003Cpackage>` then `help(module.function)`\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.\n\n# Multi-Panel Figures\n\n**\"Combine plots into a multi-panel figure\"** -> Arrange individual plots into a single composed figure with consistent sizing, shared legends\u002Faxes, and panel labels (a, b, c) in the Nature\u002FCell convention. The decision space: which composition library (patchwork most modern in R; matplotlib subfigures in Python), how to share legends and axes, and how to size at journal specifications.\n\n- R: `patchwork` (modern; supports axes\u002Fguides collection since 1.2), `cowplot` (older; align_plots), `gridExtra` (basic grid arrange)\n- Python: `matplotlib.gridspec.GridSpec`, `fig.subfigures()` (matplotlib 3.4+)\n\n## The Single Most Important Modern Insight -- Axes Collection Requires patchwork ≥ 1.2.0\n\npatchwork 1.2.0 (released 2024-01-05) added `axes = 'collect'` and `axis_titles = 'collect'` to `plot_layout()`. These collect repeated axes \u002F titles across subplots into a single shared axis label — the same way `guides = 'collect'` (available since patchwork 1.0) collects legends.\n\nWithout this, multi-panel figures with shared axes show redundant labels on every subplot (visually cluttered AND non-Nature compliant). Verify patchwork version is ≥ 1.2.0; older versions silently ignore the `axes` argument.\n\n## patchwork -- Modern R Composition\n\n**Goal:** Compose 4 ggplot objects into a 2×2 panel figure with shared legend, collected axes, and bold panel labels (a, b, c, d) in upper-left of each subplot.\n\n**Approach:** Combine plots with `+`, `\u002F`, `|` operators; apply `plot_layout(guides='collect', axes='collect')` for shared elements; add `plot_annotation(tag_levels='a')` for Nature-style panel labels.\n\n```r\nlibrary(patchwork)\nlibrary(ggplot2)\n\np1 \u003C- ggplot(df, aes(x, y)) + geom_point() + theme_classic()\np2 \u003C- ggplot(df, aes(group, value)) + geom_boxplot() + theme_classic()\np3 \u003C- ggplot(df, aes(x)) + geom_histogram() + theme_classic()\np4 \u003C- ggplot(df, aes(x, y, color = group)) + geom_point() + theme_classic()\n\n# 2x2 grid\nfig \u003C- (p1 + p2) \u002F (p3 + p4) +\n    plot_annotation(tag_levels = 'a',\n                    theme = theme(plot.tag = element_text(face = 'bold', size = 10))) +\n    plot_layout(guides = 'collect',         # share legends\n                axes = 'collect',           # share axes (patchwork >= 1.2.0)\n                axis_titles = 'collect')\n\nggsave('figure1.pdf', fig, width = 180, height = 140, units = 'mm', device = cairo_pdf)\n```\n\n## patchwork Operators\n\n```r\np1 + p2                                     # side-by-side\np1 \u002F p2                                     # vertical stack\n(p1 | p2) \u002F p3                              # mixed: top row two, bottom one\np1 + p2 + p3 + plot_layout(ncol = 3)\np1 + p2 + plot_layout(widths = c(2, 1))     # 2:1 width ratio\n\n# Complex grid via design string\ndesign \u003C- \"\nAAB\nAAB\nCCC\n\"\np1 + p2 + p3 + plot_layout(design = design)\n\n# Inset\np1 + inset_element(p2, left = 0.6, bottom = 0.6, right = 1, top = 1)\n```\n\n## cowplot -- Alternative with Alignment Focus\n\n```r\nlibrary(cowplot)\n\n# plot_grid is the workhorse\ncombined \u003C- plot_grid(p1, p2, p3, p4,\n                       ncol = 2, labels = 'AUTO',         # 'AUTO' = A, B, C, D\n                       label_size = 12, label_fontface = 'bold',\n                       align = 'hv',                       # align horizontally + vertically\n                       rel_widths = c(1, 1), rel_heights = c(1, 1))\n\n# Nested grids\ntop_row \u003C- plot_grid(p1, p2, ncol = 2, labels = c('A', 'B'))\nbottom \u003C- plot_grid(p3, p4, ncol = 2, labels = c('C', 'D'))\ncombined \u003C- plot_grid(top_row, bottom, nrow = 2, rel_heights = c(1, 1.2))\n\nggsave('figure.pdf', combined, width = 180, height = 140, units = 'mm', device = cairo_pdf)\n```\n\ncowplot is older but its alignment behavior is sometimes more reliable than patchwork on edge cases (axes-with-titles of different lengths).\n\n## matplotlib GridSpec (Python)\n\n```python\nimport matplotlib.pyplot as plt\nfrom matplotlib.gridspec import GridSpec\n\nfig = plt.figure(figsize=(180\u002F25.4, 120\u002F25.4), constrained_layout=True)\ngs = GridSpec(2, 3, figure=fig)\n\nax1 = fig.add_subplot(gs[0, 0])\nax2 = fig.add_subplot(gs[0, 1:])         # top right, spans columns 1-2\nax3 = fig.add_subplot(gs[1, :])           # bottom row, spans all columns\n\nax1.scatter(x, y, s=4, rasterized=True)\nax2.plot(x, y)\nax3.bar(cats, vals)\n\n# Panel labels at (-0.15, 1.05) of each axes\nfor ax, lbl in zip([ax1, ax2, ax3], 'abc'):\n    ax.text(-0.15, 1.05, lbl, transform=ax.transAxes,\n            fontsize=10, fontweight='bold', va='top')\n\nfig.savefig('figure.pdf', dpi=300, bbox_inches='tight')\n```\n\n## matplotlib Subfigures\n\n```python\nfig = plt.figure(figsize=(180\u002F25.4, 120\u002F25.4), constrained_layout=True)\nsubfigs = fig.subfigures(1, 2, width_ratios=[2, 1])\n\n# Left subfigure has 2 stacked panels\naxs_left = subfigs[0].subplots(2, 1)\naxs_left[0].plot(x, y)\naxs_left[1].scatter(x, y, rasterized=True)\n\n# Right subfigure has one panel\nax_right = subfigs[1].subplots(1, 1)\nax_right.imshow(matrix)\nsubfigs[1].colorbar(ax_right.images[0], ax=ax_right, shrink=0.5)\n```\n\nSubfigures are stronger than GridSpec for complex compositions because each subfigure has its own constrained_layout.\n\n## Journal Sizing\n\n| Journal | Single col | Double col | Max height |\n|---------|------------|------------|------------|\n| Nature | 89 mm | 183 mm | 247 mm |\n| Cell | 85 mm | 174 mm | 235 mm |\n| Science | 55 mm | 120 mm | 220 mm |\n| PNAS | 87 mm | 178 mm | 225 mm |\n| eLife | 86 mm | 175 mm | ~240 mm |\n\nAlways set explicit units in mm; default inches is the most common source of \"figure too large\" errors.\n\n## Panel Labels — Nature\u002FCell Convention\n\n- **Nature**: lowercase bold serif (a, b, c) in upper-left corner of each panel; 8 pt\n- **Cell**: uppercase bold sans-serif (A, B, C); placed flush left at panel top\n- **Science**: capital bold (A, B, C)\n\n```r\n# patchwork tag_levels for lowercase (Nature)\nplot_annotation(tag_levels = 'a',\n                theme = theme(plot.tag = element_text(face = 'bold', size = 9)))\n# 'A' for uppercase (Cell)\nplot_annotation(tag_levels = 'A')\n# 'i' for roman numerals (sometimes for sub-panels)\n```\n\n```r\n# cowplot\nplot_grid(..., labels = 'AUTO')   # auto uppercase A, B, C\nplot_grid(..., labels = 'auto')   # auto lowercase a, b, c\n```\n\n## Per-Method Failure Modes\n\n### patchwork axes='collect' silently ignored\n\n**Trigger:** Using `plot_layout(axes='collect')` with patchwork \u003C 1.2.0.\n\n**Mechanism:** Older versions silently accept the argument but don't act on it.\n\n**Symptom:** Redundant axes on each subplot; no warning or error.\n\n**Fix:** `packageVersion('patchwork')` must be ≥ 1.2.0. Update with `install.packages('patchwork')`.\n\n### Default ggsave produces non-portable PDF\n\n**Trigger:** `ggsave('out.pdf', fig)` without `device = cairo_pdf`.\n\n**Mechanism:** Default pdf() device produces fonts that journals reject on some systems.\n\n**Symptom:** Submission rejected at automated check; \"non-embedded fonts.\"\n\n**Fix:** Always `device = cairo_pdf`.\n\n### Figure dimensions in inches when mm intended\n\n**Trigger:** `ggsave('out.pdf', fig, width = 180, height = 140)`.\n\n**Mechanism:** Default `units = 'in'`.\n\n**Symptom:** Figure file rejected for being 180 × 140 inches.\n\n**Fix:** Explicit `units = 'mm'`.\n\n### Panel labels not aligned to panel content\n\n**Trigger:** patchwork `plot_annotation(tag_levels)` with subplots of different y-axis label widths.\n\n**Mechanism:** Tag is positioned relative to the plot canvas, including the y-axis label area.\n\n**Symptom:** Labels are at different horizontal positions in each panel.\n\n**Fix:** Either standardize y-label widths (pad with whitespace) OR move tags inside the plotting area: `theme(plot.tag.position = c(0.02, 0.98))`.\n\n### cowplot align='v' fails on plots of different widths\n\n**Trigger:** `plot_grid(p_wide, p_narrow, align = 'v')`.\n\n**Mechanism:** Vertical alignment requires same x-axis widths.\n\n**Symptom:** Plots align at the y-axis but x-axis labels are offset.\n\n**Fix:** Use `align = 'hv'` if both alignments needed; otherwise patchwork's `axes='collect'` handles this more gracefully.\n\n### Shared legend lost in patchwork\n\n**Trigger:** `(p1 + p2) + plot_layout(guides = 'collect')` but p1 and p2 use different scales.\n\n**Mechanism:** `guides='collect'` merges identical guides; different scales produce duplicate (not merged) legends.\n\n**Symptom:** Two legends still appear.\n\n**Fix:** Standardize the scales across subplots (same `scale_color_manual(values=...)`); OR drop one legend via `& theme(legend.position = 'none')` on the redundant plot.\n\n### matplotlib GridSpec with constrained_layout=False\n\n**Trigger:** Older code with `plt.subplots` no constrained_layout; tight_layout fails on colorbars.\n\n**Mechanism:** tight_layout doesn't know about post-hoc colorbars.\n\n**Symptom:** Colorbar overlaps adjacent subplot.\n\n**Fix:** `plt.figure(constrained_layout=True)` and use `fig.add_subplot(gs[...])`. constrained_layout is the default-on choice in matplotlib 3.6+.\n\n## Reconciliation\n\n| Pattern | Cause | Action |\n|---------|-------|--------|\n| patchwork and cowplot align differently | Different alignment algorithms | Try both; cowplot's `align='hv'` and patchwork's `axes='collect'` rarely produce identical results |\n| Panel labels position differs between sessions | Different y-axis label widths | Standardize across panels |\n| Shared legend duplicated | Scales differ across subplots | Use identical scales OR drop legend from N-1 panels |\n\n## Quantitative Thresholds\n\n| Threshold | Value | Source |\n|-----------|-------|--------|\n| Nature single column | 89 mm | Nature figure guidelines |\n| Nature double column | 183 mm | Nature figure guidelines |\n| Body text size | 5-7 pt | Nature rejects outside range |\n| Panel label size | 8 pt bold | Nature convention |\n| patchwork axes='collect' minimum version | 1.2.0 (2024-01-05) | patchwork release notes |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Redundant axis labels per panel | patchwork \u003C 1.2.0 OR axes='collect' not set | Update + add to plot_layout |\n| Non-embedded font rejection | Default ggsave device | `device = cairo_pdf` |\n| Figure 180 in × 140 in | Default units = 'in' | `units = 'mm'` |\n| Panel tags misaligned | Different y-label widths | Standardize or move tag inside |\n| Cowplot vertical alignment fails | Different x-axis widths | Use 'hv' OR switch to patchwork |\n| Two legends instead of shared | Scales differ across subplots | Unify scales |\n| matplotlib colorbar overlaps subplot | No constrained_layout | constrained_layout=True |\n\n## References\n\n- Pedersen TL. 2024. patchwork: the composer of plots. *CRAN package* (v1.2.0 release notes).\n- Wilke CO. 2017. cowplot: streamlined plot theme and plot annotations for ggplot2. *CRAN package*.\n- Hunter JD. 2007. Matplotlib: A 2D graphics environment. *Comput Sci Eng* 9(3):90-95.\n\n## Related Skills\n\n- data-visualization\u002Fggplot2-fundamentals - Individual ggplot objects\n- data-visualization\u002Fmatplotlib-fundamentals - Python equivalent\n- reporting\u002Ffigure-export - DPI \u002F format \u002F journal-spec compliance\n- data-visualization\u002Fcolor-palettes - Consistent palette across subpanels\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","mixed","2026-09-20","data-visualization\u002Fmultipanel-figures\u002FSKILL.md","patchwork","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-data-visualization-multipanel-figures","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-data-visualization-multipanel-figures",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-data-visualization-multipanel-figures",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-data-visualization-multipanel-figures","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-multipanel-figures\u002FSKILL.md",true,[50,56,62],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Fmulti_panel_figure.R","OTHER","其他",3449,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-multipanel-figures\u002Fexamples\u002Fmulti_panel_figure.R",{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"examples\u002Fmultipanel_matplotlib.py","SCRIPT","脚本",5495,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-multipanel-figures\u002Fexamples\u002Fmultipanel_matplotlib.py",{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},"usage-guide.md","REFERENCE","参考文档",4187,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-data-visualization-multipanel-figures\u002Fusage-guide.md",[69,77,84,91,98,105],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":76},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":76},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":76},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":76},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":76},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":76},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]