bio-reporting-figure-export
Installation
SKILL.md
Version Compatibility
Reference examples tested with: matplotlib 3.8+, numpy 1.26+, ggplot2 3.5+, ggrastr 1.0+, ragg 1.2+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show matplotlibthenhelp(matplotlib.figure.Figure.savefig); introspectmatplotlib.rcParamsif a key is renamed - R:
packageVersion('ggplot2')then?ggsave
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Publication-Ready Figure Export
"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.
- Python:
fig.savefig('fig.pdf', dpi=600)with publication rcParams set - R:
ggsave('fig.pdf', width=89, units='mm', device=cairo_pdf)
The Load-Bearing Idea: A Figure Is Four Layers
A publication figure is not one object; it is four superimposed layers, and export means giving each the representation it needs: