Skip to content
annotations

annotations

Mojo module 🡭

annotations

The annotate_*() overlays: their stored data, their validation, and the six passes that draw them.

Split out of plot.mojo. This is the most self-contained seam in that file: Plot holds an _AnnotationData and calls these six passes, and nothing else in the package touches them.

Every pass takes the finished _RenderResult and draws into the same frame the marks used, so an annotation lands on the plot’s own scales rather than on a layout of its own. Each returns its labels as _TextRequests rather than drawing them, because text is replayed after every pass so a label is never painted over.

Which overlay snaps to the pixel grid, and why, is in the individual docstrings – the short version is that a shaded band is a filled rect and snaps both edges, a reference line is a hairline and snaps its one fixed coordinate, and a fitted line is a diagonal that snaps nothing.