Legends and annotations¶
See the legends and annotations guide for usage and backend behavior.
Configuration for a scalar-field colorbar or categorical legend.
Attributes:
| Name | Type | Description |
|---|---|---|
title |
str | None
|
Display title. |
units |
str | None
|
Optional physical units appended to the title. |
ticks |
int
|
Number of continuous ticks. Ignored for categorical legends. |
format |
str
|
Python numeric format specifier, such as |
position |
Literal['left', 'right']
|
Side of the image or viewer containing the legend. |
category_labels |
dict[str, str] | None
|
Optional mapping from stringified values to labels. |
width |
int
|
Raster legend panel width in pixels. |
Source code in hakowan/grammar/overlay.py
__post_init__()
¶
Validate tick count, panel width, and numeric format.
Source code in hakowan/grammar/overlay.py
Screen-space text annotation drawn over the rendered figure.
position uses normalized image coordinates with origin at the top-left.
Values outside [0, 1] are rejected to keep output deterministic.
Source code in hakowan/grammar/overlay.py
__post_init__()
¶
Validate annotation text, normalized position, and pixel sizes.