Plotting in an Analysis Plugin
PolyzyMD uses one extension workflow for new contributions: add a single
Analysis subclass in src/polyzymd/analyses/.
If your contribution needs figures, put that logic in the plugin’s plot()
method.
Use Extending the Analysis Framework as the main contributor guide.
What to Implement
plot(ctx)to generate figures for your analysisoptional helper functions — these can live in the same file for simple plugins, or be extracted to a
_plotters.pymodule within the packageoptional
format()for matching CLI output and figures
Recommended Pattern
load any cached comparison data from the plugin context
write figures into the analysis-specific output directory provided by
ctxkeep compute, compare, and plot behavior close together so contributors only need to reason about one package
When to Extract _plotters.py
As a plugin grows, extracting plotting functions into a dedicated
_plotters.py module within the package keeps __init__.py focused on the
Analysis lifecycle. This is the established pattern for rmsf, distances,
secondary_structure, and contacts. Consider extracting when your plugin has
3+ plot functions or __init__.py exceeds ~500 lines.
See Extracting Plotting to _plotters.py in the extending analyses tutorial for details.