phenotypic.sdk_.viz package#

Shared visualization layer for PhenoTypic.

Hosts the centralized Plotly theme that every figure routes through. The public theme entry points are re-exported here for convenience.

phenotypic.sdk_.viz.apply_theme(fig: Figure) Figure[source]#

Apply the PhenoTypic theme to fig in place and return it.

Ensures the "phenotypic" template is registered, then sets the figure to use it composed with Plotly’s default template ("plotly+phenotypic"). Composition preserves Plotly’s built-in trace defaults while letting the PhenoTypic layer override layout styling (colorway, fonts, axes, legend).

Traces (fig.data) are never read, deleted, or mutated; only fig.layout.template is set. The function returns the same figure object it was given and is idempotent – applying it repeatedly leaves a single combined template and the traces untouched.

Parameters:

fig (Figure) – The figure to theme.

Returns:

The same fig object, with its layout template set to the composed "plotly+phenotypic" template.

Return type:

Figure

Example

>>> import plotly.graph_objects as go
>>> fig = go.Figure(go.Scatter(x=[1, 2], y=[3, 4]))
>>> themed = apply_theme(fig)
>>> themed is fig
True
>>> len(themed.data)
1

Subpackages#