[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EF8EZXEBG271SKRM13QWWF":3,"skill-same:01M7EF8EZXEBG271SKRM13QWWF":62},{"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":31,"commitSha":32,"skillDirectory":33,"forksCount":14,"repositoryHtmlUrl":34,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":36,"install":37,"resources":49},"01M7EF8EZXEBG271SKRM13QWWF","bio-reporting-figure-export",null,"Exports publication-ready figures with the correct vector\u002Fraster split, embedded editable fonts, color-space-robust palettes, and journal-correct sizing and resolution in matplotlib and ggplot2. Use when preparing figures for journal submission, exporting a dense single-cell or GWAS plot without producing an unopenable vector file, or fixing fonts and colors that break in print.","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-reporting-figure-export\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-reporting-figure-export\ndescription: Exports publication-ready figures with the correct vector\u002Fraster split, embedded editable fonts, color-space-robust palettes, and journal-correct sizing and resolution in matplotlib and ggplot2. Use when preparing figures for journal submission, exporting a dense single-cell or GWAS plot without producing an unopenable vector file, or fixing fonts and colors that break in print.\ntool_type: mixed\nprimary_tool: matplotlib\ngoal_approach_exempt: true\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"reporting\u002Ffigure-export\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: matplotlib 3.8+, numpy 1.26+, ggplot2 3.5+, ggrastr 1.0+, ragg 1.2+\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- Python: `pip show matplotlib` then `help(matplotlib.figure.Figure.savefig)`; introspect `matplotlib.rcParams` if a key is renamed\n- R: `packageVersion('ggplot2')` then `?ggsave`\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# Publication-Ready Figure Export\n\n**\"Export this figure for the journal\"** -> Save the plot so each part of it survives production: vector structure stays crisp, the dense data layer stays a reasonable file size, text stays editable, and color survives the print conversion.\n- Python: `fig.savefig('fig.pdf', dpi=600)` with publication rcParams set\n- R: `ggsave('fig.pdf', width=89, units='mm', device=cairo_pdf)`\n\n## The Load-Bearing Idea: A Figure Is Four Layers\n\nA publication figure is not one object; it is four superimposed layers, and export means giving each the representation it needs:\n\n1. **Vector structure** - axes, ticks, spines, gridlines, fit lines, error bars, annotations. Resolution-independent; must stay vector so the typesetter can scale it to 89 mm without pixelation.\n2. **Raster data layer** - the dense part: a scatter with 10^5-10^7 points, a heatmap, a micrograph. Drawing a million points as a million vector circles makes a hundreds-of-MB PDF that crashes Illustrator. This layer wants to be pixels.\n3. **Type** - every glyph. Editors need it to stay selectable text, not flattened paths or pixels baked into the raster.\n4. **Color encoding** - the data-to-color mapping. A scientific choice (perceptual uniformity, color-vision-deficiency safety, grayscale survival) that also interacts with the RGB->CMYK conversion the journal performs without asking.\n\nThe expert move is the **hybrid figure**: rasterize only layer 2, keep layers 1 and 3 vector, embed editable fonts, and pick a colormap that survives CMYK and grayscale. Everything below serves that.\n\nA reproducibility framing: a figure is a pure function of (data, code, theme, font availability). If any of those is unpinned, the figure is not reproducible.\n\n## The Hybrid Figure (rasterize only the dense layer)\n\nThe single most important export skill for single-cell (UMAP\u002FtSNE) and GWAS (Manhattan) figures. A fully-vector million-point scatter is unopenable and gets rejected by the typesetter's RIP; rasterizing just the data layer keeps file size sane while axes and text stay crisp at any zoom.\n\n```python\nimport matplotlib.pyplot as plt\nfig, ax = plt.subplots(figsize=(3.5, 3.0))     # physical inches = the real size control\nax.scatter(x, y, s=2, rasterized=True, zorder=0)   # 10^6 points -> embedded raster\nax.plot(xfit, yfit, color='black', zorder=2)        # stays vector\nax.set_xlabel('UMAP1')                              # stays vector text\nfig.savefig('fig.pdf', dpi=600)                     # dpi governs ONLY the rasterized layer\n```\n\nIn a vector container, `savefig(dpi=...)` sets the resolution of the embedded raster patch and does nothing to the vector parts. `ax.set_rasterization_zorder(0)` rasterizes every artist below a z-order cleanly. In R use `ggrastr::rasterise(geom_point(size=0.3), dpi=600)` (wraps any geom since 0.2.0), keeping `theme_*` vector.\n\n## Fonts: Keep the Text Editable\n\nThe most common typesetter complaint about matplotlib PDFs is un-editable text. matplotlib's default `pdf.fonttype` is **3** (Type 3), which embeds glyphs as PostScript procedures that import into Illustrator as ungrouped paths and cannot be re-selected as text. Set **42** (TrueType, wrapped) so text stays selectable and editable. Fix it once, globally:\n\n```python\nimport matplotlib as mpl\nmpl.rcParams['pdf.fonttype'] = 42      # TrueType, editable text in PDF\nmpl.rcParams['ps.fonttype']  = 42      # same for EPS\u002FPS\nmpl.rcParams['svg.fonttype'] = 'none'  # SVG: emit real \u003Ctext>, reference the font by name\n```\n\nType 42\u002FTrueType\u002FType 3 fonts are subsetted (only used glyphs embedded); Type 1 are not. With large glyph sets (CJK) Type 42 can bloat the PDF - a real tradeoff. `svg.fonttype='none'` keeps words editable in Inkscape\u002FIllustrator but the viewer must have the font (else it substitutes); the default `'path'` outlines every glyph (portable, uneditable). Default to editable text; only outline if a specific production desk asks.\n\nIn R, the base `pdf()` device has weak font handling and inconsistent cross-OS rendering; use `cairo_pdf` (embeds fonts and supports alpha). For raster, `ragg::agg_png()`\u002F`agg_tiff()` render anti-aliased text better than cairo\u002Fbase devices. Rule of thumb: `showtext` for vector devices, `ragg` for raster.\n\n## Color Space: The Author Works in RGB, Print Is CMYK\n\nScreens are additive RGB; offset print is subtractive CMYK. matplotlib and ggplot2 author in RGB only - there is no honest path to a true CMYK figure from them. The journal's pipeline converts RGB->CMYK, and because the CMYK gamut is smaller than sRGB, **saturated out-of-gamut colors shift**: pure RGB blue (#0000FF) and vivid green\u002Fcyan come back muddier and darker on paper. The neon scatter that pops on screen can print gray.\n\nWhat to do: pull colors slightly off full saturation (they survive conversion better); soft-proof downstream in Illustrator\u002FPhotoshop with a CMYK profile if it matters; and submit RGB - Nature, Science, Cell, and PLOS all explicitly want RGB, not CMYK, because their pipeline does the conversion and online is RGB anyway. If a legacy desk demands CMYK, convert downstream with an explicit profile and re-check that nothing shifted; do not fake it with a colorspace flag.\n\n## Transparency: EPS Has No Alpha\n\nEPS\u002FPostScript do not support alpha - matplotlib's PS backend renders partially-transparent artists as opaque, so an alpha-blended overplotted scatter loses its density information on EPS export. PDF and SVG support alpha natively; prefer them when transparency carries meaning. If a journal forces EPS and transparency is needed, rasterize that layer (`rasterized=True`) or re-encode density as hexbin\u002F2D-KDE. `savefig(transparent=True)` makes the background transparent for slide overlays, not for print.\n\n## DPI Is Meaningless for Vector\n\nA vector PDF has no inherent resolution; it renders sharp at any zoom. DPI governs only raster formats (PNG\u002FTIFF) and the rasterized data layer inside a vector file. The real size control is the **physical figure size** in inches\u002Fmm - design at the journal's exact column width from the start; rescaling a 300-dpi raster to 200% halves its effective resolution. Font sizes are in points (1 pt = 1\u002F72 in) independent of DPI.\n\nThe DPI tiers follow the IMAGE CLASS, because print reproduces tone via halftone dots (follow the target journal's own numbers; these are the common production convention):\n\n| Image class | DPI | Why |\n|-------------|-----|-----|\n| Halftone \u002F grayscale \u002F color photo | 300 | continuous tone matches typical screen rulings |\n| Combination (halftone + line\u002Ftext) | 500-600 | thin lines and small type must not jag against toned background |\n| Line art (pure black\u002Fwhite) | 1000-1200 | hard edges alias badly at low DPI - or keep it vector and DPI is moot |\n\n`savefig.dpi` is the file resolution; `figure.dpi` is the on-screen resolution. Independently of DPI, very thin strokes (below ~0.25 pt \u002F 0.1 mm) can drop out or thicken unpredictably at the printer's RIP even in a vector file - keep hairlines at or above the journal's minimum line weight.\n\n## Format Decision\n\n| Format | Type | Use for | Avoid for |\n|--------|------|---------|-----------|\n| PDF | vector(+raster) | default for most journals; hybrid figures; alpha works | - |\n| EPS | vector(+raster) | legacy journal requirement | anything with alpha (flattened opaque) |\n| SVG | vector | web; handoff to Illustrator\u002FInkscape for editing | final print at some desks (support varies) |\n| TIFF (LZW) | raster, lossless | print production when a journal demands raster (Cell, PLOS) | large vector-friendly line figures |\n| PNG | raster, lossless | online, previews, slides, README figures | print where vector is accepted |\n| JPEG | raster, LOSSY | photographs only | any figure with text\u002Flines\u002Fedges (DCT ringing) |\n\nNever JPEG for line\u002Ftext figures - block compression rings along high-contrast edges (gray halos on text, fringing on thin lines). For TIFF, use LZW (near-universal reader support) for 8-bit figures; use ZIP for 16-bit (LZW can inflate 16-bit files).\n\n## Colormaps Are a Scientific Choice, Not Taste\n\nPerceptually-uniform maps (viridis, cividis, magma, inferno, plasma) are constructed in CAM02-UCS so equal data steps map to equal perceived steps with monotonically increasing lightness - which is exactly why they survive grayscale and avoid inventing false gradients. **cividis** is additionally optimized so viewers with and without red-green color-vision deficiency see nearly the same image. By contrast, jet\u002Frainbow has non-monotonic luminance that invents bright\u002Fdark bands the data does not have (false edges at yellow\u002Fcyan) and collapses to mush in grayscale - a correctness failure, not an aesthetic one.\n\n- Sequential map for ordered data; diverging map (with a meaningful midpoint) for signed data; a categorical CVD-safe palette for discrete classes - never a continuous rainbow for categories.\n- Use the **Okabe-Ito** 8-color Color Universal Design palette for categories. Red-green CVD affects up to ~8% of males (population-dependent), so add **redundant encoding** (shape + color, linetype + color, direct labels) so color is never the sole channel.\n- Run the grayscale-photocopy test: convert to grayscale and confirm the figure still reads.\n\n## Reproducible Export\n\n- **Byte-stable PDFs:** matplotlib stamps a `CreationDate` into every PDF, so two identical runs differ byte-for-byte (noisy git diffs). Pass `metadata={'CreationDate': None}` to `savefig`, or set the `SOURCE_DATE_EPOCH` env var, for deterministic output.\n- **`bbox_inches='tight'` breaks exact widths.** It recomputes the bounding box from drawn content, so output dimensions depend on tick-label lengths and the renderer's font metrics - the same script on two machines (different fonts) yields different-sized PDFs, and it can clip annotations. For camera-ready figures at an exact 89 mm, design to size with `constrained_layout=True` and save without `bbox_inches='tight'`; if cropping is unavoidable, pair it with explicit `pad_inches`.\n- **Font-availability nondeterminism:** Helvetica on a Mac vs DejaVu Sans on CI gives different glyph widths, line breaks, and (with tight bbox) different sizes. Pin the font or accept the default and don't crop-to-content.\n- **Headless rendering:** call `matplotlib.use('Agg')` before importing pyplot on a cluster\u002FCI box, or just use the file backends, so no display is required.\n\n## Journal Specs (verify against the target journal at submission)\n\nSpecs change and vary by sub-journal; re-pull the target's author-guideline page. Snapshot, June 2026:\n\n| Journal | Widths | Min DPI | Formats | Color |\n|---------|--------|---------|---------|-------|\n| Nature | 89 mm single \u002F 183 mm double; \u003C=170 mm tall | 300 photo, 600+ line | vector AI\u002FEPS\u002FPDF preferred; TIFF raster | RGB |\n| Science | 5.7 \u002F 12.1 \u002F 18.4 cm | >=300 at final size; vector preferred | Illustrator-openable vector; no PowerPoint | RGB (not CMYK) |\n| Cell Press | 85 \u002F 114 \u002F 174 mm | 300 color, 500 grayscale, 1000 line | TIFF (LZW) or vector | RGB |\n| PLOS | 789-2250 px wide; \u003C=2625 px tall | 300-600 (do not exceed 600) | TIFF or EPS only; flattened, LZW, no alpha\u002Flayers | RGB or grayscale, 8-bit; no CMYK |\n\nPLOS is strictest (8-bit RGB\u002Fgrayscale TIFF, no alpha channel, no layers). Cell's grayscale (500) and line (1000) tiers exceed the generic numbers - follow the journal's own.\n\n## Common Errors\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| Typesetter: \"supply editable text\" | default Type 3 fonts | `pdf.fonttype=42`, `ps.fonttype=42`, `svg.fonttype='none'` |\n| PDF won't open \u002F hundreds of MB | fully-vector dense scatter | rasterize the data layer (`rasterized=True` \u002F `ggrastr::rasterise`) |\n| Colors muddy in print | saturated RGB out of CMYK gamut | desaturate slightly; soft-proof; submit RGB |\n| Transparency gone on EPS | EPS has no alpha | rasterize that layer, or use PDF\u002FSVG, or hexbin |\n| Figure not exactly 89 mm | `bbox_inches='tight'` non-deterministic size | design to size + `constrained_layout`, drop tight bbox |\n| Heatmap shows false bands | jet\u002Frainbow non-monotonic luminance | viridis\u002Fcividis (sequential), diverging map for signed data |\n| Noisy git diff on identical figure | PDF `CreationDate` timestamp | `metadata={'CreationDate': None}` or `SOURCE_DATE_EPOCH` |\n\n## Related Skills\n\n- data-visualization\u002Fggplot2-fundamentals - Building the plots in R\n- data-visualization\u002Fmatplotlib-fundamentals - Building the plots in Python\n- data-visualization\u002Fmultipanel-figures - Composing multi-panel layouts\n- data-visualization\u002Fcolor-palettes - Choosing perceptual and CVD-safe palettes\n- reporting\u002Fpublication-tables - The table counterpart to figure export\n\n## References\n\n- Borland D, Taylor RM 2nd. Rainbow Color Map (Still) Considered Harmful. IEEE Comput Graph Appl. 2007;27(2):14-17. doi:10.1109\u002FMCG.2007.323435\n- Nuñez JR, Anderton CR, Renslow RS. Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data. PLoS ONE. 2018;13(7):e0199239. doi:10.1371\u002Fjournal.pone.0199239\n- Okabe M, Ito K. Color Universal Design (CUD): how to make figures and presentations friendly to colorblind people. jfly.uni-koeln.de\u002Fcolor\u002F (8-color CVD-safe palette)\n- van der Walt S, Smith N. A Better Default Colormap for Matplotlib. SciPy 2015 (conference talk; viridis\u002Fmagma\u002Finferno\u002Fplasma constructed in CAM02-UCS). bids.github.io\u002Fcolormap\n","## Version Compatibility\n\nReference examples tested with: matplotlib 3.8+, numpy 1.26+, ggplot2 3.5+, ggrastr 1.0+, ragg 1.2+\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- Python: `pip show matplotlib` then `help(matplotlib.figure.Figure.savefig)`; introspect `matplotlib.rcParams` if a key is renamed\n- R: `packageVersion('ggplot2')` then `?ggsave`\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# Publication-Ready Figure Export\n\n**\"Export this figure for the journal\"** -> Save the plot so each part of it survives production: vector structure stays crisp, the dense data layer stays a reasonable file size, text stays editable, and color survives the print conversion.\n- Python: `fig.savefig('fig.pdf', dpi=600)` with publication rcParams set\n- R: `ggsave('fig.pdf', width=89, units='mm', device=cairo_pdf)`\n\n## The Load-Bearing Idea: A Figure Is Four Layers\n\nA publication figure is not one object; it is four superimposed layers, and export means giving each the representation it needs:\n\n1. **Vector structure** - axes, ticks, spines, gridlines, fit lines, error bars, annotations. Resolution-independent; must stay vector so the typesetter can scale it to 89 mm without pixelation.\n2. **Raster data layer** - the dense part: a scatter with 10^5-10^7 points, a heatmap, a micrograph. Drawing a million points as a million vector circles makes a hundreds-of-MB PDF that crashes Illustrator. This layer wants to be pixels.\n3. **Type** - every glyph. Editors need it to stay selectable text, not flattened paths or pixels baked into the raster.\n4. **Color encoding** - the data-to-color mapping. A scientific choice (perceptual uniformity, color-vision-deficiency safety, grayscale survival) that also interacts with the RGB->CMYK conversion the journal performs without asking.\n\nThe expert move is the **hybrid figure**: rasterize only layer 2, keep layers 1 and 3 vector, embed editable fonts, and pick a colormap that survives CMYK and grayscale. Everything below serves that.\n\nA reproducibility framing: a figure is a pure function of (data, code, theme, font availability). If any of those is unpinned, the figure is not reproducible.\n\n## The Hybrid Figure (rasterize only the dense layer)\n\nThe single most important export skill for single-cell (UMAP\u002FtSNE) and GWAS (Manhattan) figures. A fully-vector million-point scatter is unopenable and gets rejected by the typesetter's RIP; rasterizing just the data layer keeps file size sane while axes and text stay crisp at any zoom.\n\n```python\nimport matplotlib.pyplot as plt\nfig, ax = plt.subplots(figsize=(3.5, 3.0))     # physical inches = the real size control\nax.scatter(x, y, s=2, rasterized=True, zorder=0)   # 10^6 points -> embedded raster\nax.plot(xfit, yfit, color='black', zorder=2)        # stays vector\nax.set_xlabel('UMAP1')                              # stays vector text\nfig.savefig('fig.pdf', dpi=600)                     # dpi governs ONLY the rasterized layer\n```\n\nIn a vector container, `savefig(dpi=...)` sets the resolution of the embedded raster patch and does nothing to the vector parts. `ax.set_rasterization_zorder(0)` rasterizes every artist below a z-order cleanly. In R use `ggrastr::rasterise(geom_point(size=0.3), dpi=600)` (wraps any geom since 0.2.0), keeping `theme_*` vector.\n\n## Fonts: Keep the Text Editable\n\nThe most common typesetter complaint about matplotlib PDFs is un-editable text. matplotlib's default `pdf.fonttype` is **3** (Type 3), which embeds glyphs as PostScript procedures that import into Illustrator as ungrouped paths and cannot be re-selected as text. Set **42** (TrueType, wrapped) so text stays selectable and editable. Fix it once, globally:\n\n```python\nimport matplotlib as mpl\nmpl.rcParams['pdf.fonttype'] = 42      # TrueType, editable text in PDF\nmpl.rcParams['ps.fonttype']  = 42      # same for EPS\u002FPS\nmpl.rcParams['svg.fonttype'] = 'none'  # SVG: emit real \u003Ctext>, reference the font by name\n```\n\nType 42\u002FTrueType\u002FType 3 fonts are subsetted (only used glyphs embedded); Type 1 are not. With large glyph sets (CJK) Type 42 can bloat the PDF - a real tradeoff. `svg.fonttype='none'` keeps words editable in Inkscape\u002FIllustrator but the viewer must have the font (else it substitutes); the default `'path'` outlines every glyph (portable, uneditable). Default to editable text; only outline if a specific production desk asks.\n\nIn R, the base `pdf()` device has weak font handling and inconsistent cross-OS rendering; use `cairo_pdf` (embeds fonts and supports alpha). For raster, `ragg::agg_png()`\u002F`agg_tiff()` render anti-aliased text better than cairo\u002Fbase devices. Rule of thumb: `showtext` for vector devices, `ragg` for raster.\n\n## Color Space: The Author Works in RGB, Print Is CMYK\n\nScreens are additive RGB; offset print is subtractive CMYK. matplotlib and ggplot2 author in RGB only - there is no honest path to a true CMYK figure from them. The journal's pipeline converts RGB->CMYK, and because the CMYK gamut is smaller than sRGB, **saturated out-of-gamut colors shift**: pure RGB blue (#0000FF) and vivid green\u002Fcyan come back muddier and darker on paper. The neon scatter that pops on screen can print gray.\n\nWhat to do: pull colors slightly off full saturation (they survive conversion better); soft-proof downstream in Illustrator\u002FPhotoshop with a CMYK profile if it matters; and submit RGB - Nature, Science, Cell, and PLOS all explicitly want RGB, not CMYK, because their pipeline does the conversion and online is RGB anyway. If a legacy desk demands CMYK, convert downstream with an explicit profile and re-check that nothing shifted; do not fake it with a colorspace flag.\n\n## Transparency: EPS Has No Alpha\n\nEPS\u002FPostScript do not support alpha - matplotlib's PS backend renders partially-transparent artists as opaque, so an alpha-blended overplotted scatter loses its density information on EPS export. PDF and SVG support alpha natively; prefer them when transparency carries meaning. If a journal forces EPS and transparency is needed, rasterize that layer (`rasterized=True`) or re-encode density as hexbin\u002F2D-KDE. `savefig(transparent=True)` makes the background transparent for slide overlays, not for print.\n\n## DPI Is Meaningless for Vector\n\nA vector PDF has no inherent resolution; it renders sharp at any zoom. DPI governs only raster formats (PNG\u002FTIFF) and the rasterized data layer inside a vector file. The real size control is the **physical figure size** in inches\u002Fmm - design at the journal's exact column width from the start; rescaling a 300-dpi raster to 200% halves its effective resolution. Font sizes are in points (1 pt = 1\u002F72 in) independent of DPI.\n\nThe DPI tiers follow the IMAGE CLASS, because print reproduces tone via halftone dots (follow the target journal's own numbers; these are the common production convention):\n\n| Image class | DPI | Why |\n|-------------|-----|-----|\n| Halftone \u002F grayscale \u002F color photo | 300 | continuous tone matches typical screen rulings |\n| Combination (halftone + line\u002Ftext) | 500-600 | thin lines and small type must not jag against toned background |\n| Line art (pure black\u002Fwhite) | 1000-1200 | hard edges alias badly at low DPI - or keep it vector and DPI is moot |\n\n`savefig.dpi` is the file resolution; `figure.dpi` is the on-screen resolution. Independently of DPI, very thin strokes (below ~0.25 pt \u002F 0.1 mm) can drop out or thicken unpredictably at the printer's RIP even in a vector file - keep hairlines at or above the journal's minimum line weight.\n\n## Format Decision\n\n| Format | Type | Use for | Avoid for |\n|--------|------|---------|-----------|\n| PDF | vector(+raster) | default for most journals; hybrid figures; alpha works | - |\n| EPS | vector(+raster) | legacy journal requirement | anything with alpha (flattened opaque) |\n| SVG | vector | web; handoff to Illustrator\u002FInkscape for editing | final print at some desks (support varies) |\n| TIFF (LZW) | raster, lossless | print production when a journal demands raster (Cell, PLOS) | large vector-friendly line figures |\n| PNG | raster, lossless | online, previews, slides, README figures | print where vector is accepted |\n| JPEG | raster, LOSSY | photographs only | any figure with text\u002Flines\u002Fedges (DCT ringing) |\n\nNever JPEG for line\u002Ftext figures - block compression rings along high-contrast edges (gray halos on text, fringing on thin lines). For TIFF, use LZW (near-universal reader support) for 8-bit figures; use ZIP for 16-bit (LZW can inflate 16-bit files).\n\n## Colormaps Are a Scientific Choice, Not Taste\n\nPerceptually-uniform maps (viridis, cividis, magma, inferno, plasma) are constructed in CAM02-UCS so equal data steps map to equal perceived steps with monotonically increasing lightness - which is exactly why they survive grayscale and avoid inventing false gradients. **cividis** is additionally optimized so viewers with and without red-green color-vision deficiency see nearly the same image. By contrast, jet\u002Frainbow has non-monotonic luminance that invents bright\u002Fdark bands the data does not have (false edges at yellow\u002Fcyan) and collapses to mush in grayscale - a correctness failure, not an aesthetic one.\n\n- Sequential map for ordered data; diverging map (with a meaningful midpoint) for signed data; a categorical CVD-safe palette for discrete classes - never a continuous rainbow for categories.\n- Use the **Okabe-Ito** 8-color Color Universal Design palette for categories. Red-green CVD affects up to ~8% of males (population-dependent), so add **redundant encoding** (shape + color, linetype + color, direct labels) so color is never the sole channel.\n- Run the grayscale-photocopy test: convert to grayscale and confirm the figure still reads.\n\n## Reproducible Export\n\n- **Byte-stable PDFs:** matplotlib stamps a `CreationDate` into every PDF, so two identical runs differ byte-for-byte (noisy git diffs). Pass `metadata={'CreationDate': None}` to `savefig`, or set the `SOURCE_DATE_EPOCH` env var, for deterministic output.\n- **`bbox_inches='tight'` breaks exact widths.** It recomputes the bounding box from drawn content, so output dimensions depend on tick-label lengths and the renderer's font metrics - the same script on two machines (different fonts) yields different-sized PDFs, and it can clip annotations. For camera-ready figures at an exact 89 mm, design to size with `constrained_layout=True` and save without `bbox_inches='tight'`; if cropping is unavoidable, pair it with explicit `pad_inches`.\n- **Font-availability nondeterminism:** Helvetica on a Mac vs DejaVu Sans on CI gives different glyph widths, line breaks, and (with tight bbox) different sizes. Pin the font or accept the default and don't crop-to-content.\n- **Headless rendering:** call `matplotlib.use('Agg')` before importing pyplot on a cluster\u002FCI box, or just use the file backends, so no display is required.\n\n## Journal Specs (verify against the target journal at submission)\n\nSpecs change and vary by sub-journal; re-pull the target's author-guideline page. Snapshot, June 2026:\n\n| Journal | Widths | Min DPI | Formats | Color |\n|---------|--------|---------|---------|-------|\n| Nature | 89 mm single \u002F 183 mm double; \u003C=170 mm tall | 300 photo, 600+ line | vector AI\u002FEPS\u002FPDF preferred; TIFF raster | RGB |\n| Science | 5.7 \u002F 12.1 \u002F 18.4 cm | >=300 at final size; vector preferred | Illustrator-openable vector; no PowerPoint | RGB (not CMYK) |\n| Cell Press | 85 \u002F 114 \u002F 174 mm | 300 color, 500 grayscale, 1000 line | TIFF (LZW) or vector | RGB |\n| PLOS | 789-2250 px wide; \u003C=2625 px tall | 300-600 (do not exceed 600) | TIFF or EPS only; flattened, LZW, no alpha\u002Flayers | RGB or grayscale, 8-bit; no CMYK |\n\nPLOS is strictest (8-bit RGB\u002Fgrayscale TIFF, no alpha channel, no layers). Cell's grayscale (500) and line (1000) tiers exceed the generic numbers - follow the journal's own.\n\n## Common Errors\n\n| Symptom | Cause | Fix |\n|---------|-------|-----|\n| Typesetter: \"supply editable text\" | default Type 3 fonts | `pdf.fonttype=42`, `ps.fonttype=42`, `svg.fonttype='none'` |\n| PDF won't open \u002F hundreds of MB | fully-vector dense scatter | rasterize the data layer (`rasterized=True` \u002F `ggrastr::rasterise`) |\n| Colors muddy in print | saturated RGB out of CMYK gamut | desaturate slightly; soft-proof; submit RGB |\n| Transparency gone on EPS | EPS has no alpha | rasterize that layer, or use PDF\u002FSVG, or hexbin |\n| Figure not exactly 89 mm | `bbox_inches='tight'` non-deterministic size | design to size + `constrained_layout`, drop tight bbox |\n| Heatmap shows false bands | jet\u002Frainbow non-monotonic luminance | viridis\u002Fcividis (sequential), diverging map for signed data |\n| Noisy git diff on identical figure | PDF `CreationDate` timestamp | `metadata={'CreationDate': None}` or `SOURCE_DATE_EPOCH` |\n\n## Related Skills\n\n- data-visualization\u002Fggplot2-fundamentals - Building the plots in R\n- data-visualization\u002Fmatplotlib-fundamentals - Building the plots in Python\n- data-visualization\u002Fmultipanel-figures - Composing multi-panel layouts\n- data-visualization\u002Fcolor-palettes - Choosing perceptual and CVD-safe palettes\n- reporting\u002Fpublication-tables - The table counterpart to figure export\n\n## References\n\n- Borland D, Taylor RM 2nd. Rainbow Color Map (Still) Considered Harmful. IEEE Comput Graph Appl. 2007;27(2):14-17. doi:10.1109\u002FMCG.2007.323435\n- Nuñez JR, Anderton CR, Renslow RS. Optimizing colormaps with consideration for color vision deficiency to enable accurate interpretation of scientific data. PLoS ONE. 2018;13(7):e0199239. doi:10.1371\u002Fjournal.pone.0199239\n- Okabe M, Ito K. Color Universal Design (CUD): how to make figures and presentations friendly to colorblind people. jfly.uni-koeln.de\u002Fcolor\u002F (8-color CVD-safe palette)\n- van der Walt S, Smith N. A Better Default Colormap for Matplotlib. SciPy 2015 (conference talk; viridis\u002Fmagma\u002Finferno\u002Fplasma constructed in CAM02-UCS). bids.github.io\u002Fcolormap\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29,"goal_approach_exempt":30},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","mixed","2026-09-20","reporting\u002Ffigure-export\u002FSKILL.md","matplotlib","GPTomics\u002FbioSkills",true,"main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-reporting-figure-export","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":38,"prompt":48,"zipAvailable":30},[39,42,45],{"tool":40,"command":41},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-reporting-figure-export",{"tool":43,"command":44},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-reporting-figure-export",{"tool":46,"command":47},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-reporting-figure-export","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-reporting-figure-export\u002FSKILL.md",[50,56],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Fpublication_figures.py","SCRIPT","脚本",4344,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-reporting-figure-export\u002Fexamples\u002Fpublication_figures.py",{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"usage-guide.md","REFERENCE","参考文档",3489,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-reporting-figure-export\u002Fusage-guide.md",[63,71,78,85,92,99],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":70},"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":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":70},"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":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":70},"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":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":70},"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":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":70},"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":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":70},"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",[],[]]