FigureAtom

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class FigureAtom(*args, **kwargs)[source]

Bases: Protocol

One drawable, persistable figure.

Implement this protocol to plug a custom figure into Report.figures without subclassing HABIT types. draw must return a matplotlib Figure or None (skip). It must not write files.

stem(subject_id: str) → str[source]

Return the destination filename stem (no directory, no suffix).

Built-in atoms use <subject_id>_<kind>. Report writes that stem as-is when figure_layout="flat", and strips the leading <subject_id>_ when figure_layout="by_subject".

draw(ctx: SubjectContext) → Any | None[source]

Return a matplotlib Figure, or None to skip this subject.

__init__(*args, **kwargs)