This guide covers exporting figures that survive journal production. The central idea is that a figure is four layers - vector structure, a dense raster data layer, editable type, and a color encoding - and export means giving each the representation it needs. The decisions that actually matter are: rasterize the dense layer (so a million-point scatter does not produce an unopenable vector file), keep fonts as editable text, choose colors that survive the print RGB-to-CMYK conversion and grayscale, and design at the journal's exact width.
# Python
pip install matplotlib numpy
# R
install.packages(c('ggplot2', 'ggrastr', 'ragg', 'svglite'))
Tell your AI agent what you want to do: - "Export this UMAP without making a 200 MB PDF the typesetter can't open" - "Save my figure for Nature at 89 mm with editable fonts" - "My PDF text is uneditable in Illustrator - fix the font type" - "Export a TIFF with LZW compression for Cell" - "Pick a colorblind-safe palette that also survives grayscale printing"
"Rasterize the scatter points but keep the axes and labels vector so the file opens"
"Export my single-cell UMAP as a PDF that production can actually open"
"Make the text in my matplotlib PDF selectable and editable"
"Export my ggplot as a 174 mm two-column figure with embedded fonts"
"Format my figure for Nature submission at 89 mm single-column width, RGB"
"Export as flattened 8-bit TIFF with LZW, no alpha, for PLOS"
"Replace the rainbow heatmap with a perceptually uniform map that reads in grayscale"
"Make the exported PDF byte-stable so it does not show up as changed in git every run"
pdf.fonttype=42), constrained layout, target font sizesrasterized=True / ggrastr::rasterise) while keeping structure and text vectorpdf.fonttype is Type 3 (uneditable). Set 42 once, globally, to avoid revise-and-resubmit over fonts.bbox_inches='tight' for camera-ready figures - it makes output size depend on font metrics. Use constrained_layout instead.