Skip to content

rendering

Reusable rendering primitives for summary plots.

TextPanel dataclass

Declarative text panel rendered through a Matplotlib axes.

Source code in process/core/io/plot/summary/rendering.py
19
20
21
22
23
24
25
26
@dataclass(frozen=True)
class TextPanel:
    """Declarative text panel rendered through a Matplotlib axes."""

    x: float
    y: float
    text: str
    options: dict[str, Any] = field(default_factory=dict)

x instance-attribute

y instance-attribute

text instance-attribute

options = field(default_factory=dict) class-attribute instance-attribute

ArrowSpec dataclass

Declarative annotation arrow.

Source code in process/core/io/plot/summary/rendering.py
29
30
31
32
33
34
35
36
37
@dataclass(frozen=True)
class ArrowSpec:
    """Declarative annotation arrow."""

    start: tuple[float, float]
    end: tuple[float, float]
    transform: Transform | None = None
    options: dict[str, Any] = field(default_factory=dict)
    zorder: float = 1

start instance-attribute

end instance-attribute

transform = None class-attribute instance-attribute

options = field(default_factory=dict) class-attribute instance-attribute

zorder = 1 class-attribute instance-attribute

draw_text_panels(axis, panels)

Render a sequence of declarative text panels.

Source code in process/core/io/plot/summary/rendering.py
40
41
42
def draw_text_panels(axis: Axes, panels: Iterable[TextPanel]) -> list[Text]:
    """Render a sequence of declarative text panels."""
    return [axis.text(panel.x, panel.y, panel.text, **panel.options) for panel in panels]

draw_arrows(axis, arrows)

Render a sequence of declarative arrows.

Source code in process/core/io/plot/summary/rendering.py
45
46
47
48
49
50
51
52
53
54
55
56
57
def draw_arrows(axis: Axes, arrows: Iterable[ArrowSpec]) -> list[Annotation]:
    """Render a sequence of declarative arrows."""
    return [
        axis.annotate(
            "",
            xy=arrow.end,
            xytext=arrow.start,
            xycoords=arrow.transform or axis.transData,
            arrowprops=arrow.options,
            zorder=arrow.zorder,
        )
        for arrow in arrows
    ]