phenotypic.abc_.figure#
- phenotypic.abc_.figure(*, title: str, section: str = 'default', controls: dict[str, Control] | None = None, description: Any = None, primary: bool = False) Callable[[Callable[..., 'go.Figure']], Callable[..., 'go.Figure']][source]#
Mark a method as a figure builder and auto-apply the house Plotly theme.
The decorated method returns a raw
plotly.graph_objects.Figure, accepts each control as a keyword argument, and may accept a subject as its first positional parameter (any positional-or-keyword parameter that is not itself a control). The decorator:validates that every
controlskey names a real parameter,detects
wants_subject/subject_paramfrom the signature,stashes a
FigureSpeconfn.__figure_spec__(invisible to pydantic), andwraps the method so its returned figure is restyled via the
"phenotypic"template (imported lazily, so this module stays UI-toolkit-free).
- Parameters:
- Returns:
A decorator that returns the wrapped, theme-applying method.
- Raises:
ValueError – If a
controlskey is not a parameter of the method.- Return type:
Callable[[Callable[…, ‘go.Figure’]], Callable[…, ‘go.Figure’]]