Skip to content

Index

subsurfaceio.plotly_utils

Shared Plotly helpers.

Register the module template and the Plotly Express mixed-dtype patch:

from subsurfaceio.plotly_utils import ensure_plotly_ready

ensure_plotly_ready()

Trace styling literals live on Literals.

Modules:

Name Description
patches
shapes_3d

Three-dimensional Plotly surface primitives.

traces_props

Plotly trace property literals for subsurfaceio models.

Functions:

Name Description
ensure_plotly_ready

Register the subsurfaceio Plotly template and patch Plotly Express once.

register_template

Register the module Plotly template without changing the global default.

Attributes:

Name Type Description
FIGURE_CONFIG dict[str, Any]

Default Plotly figure config for fig.show() in the browser renderer.

TEMPLATE str

Template string for module-owned Plotly figures.

TEMPLATE_NAME str

Registered name of the module Plotly layout template.

FIGURE_CONFIG module-attribute

FIGURE_CONFIG: dict[str, Any] = {
    "displaylogo": False,
    "modeBarButtonsToAdd": [
        "v1hovermode",
        "toggleSpikeLines",
    ],
    "modeBarButtonsToRemove": [
        "lasso2d",
        "select2d",
        "zoomIn2d",
        "autoScale2d",
        "zoomOut2d",
    ],
    "toImageButtonOptions": dict(format="svg"),
}

Default Plotly figure config for fig.show() in the browser renderer.

Pass to the renderer config when displaying figures interactively, for example pio.renderers['browser'].config.update(FIGURE_CONFIG).

TEMPLATE module-attribute

TEMPLATE: str = f'simple_white+{TEMPLATE_NAME}'

Template string for module-owned Plotly figures.

Compose simple_white with the registered subsurfaceio template. Pass to Plotly Express (template=TEMPLATE) or apply with fig.update_layout(template=TEMPLATE).

TEMPLATE_NAME module-attribute

TEMPLATE_NAME: str = 'subsurfaceio'

Registered name of the module Plotly layout template.

ensure_plotly_ready

ensure_plotly_ready() -> None

Register the subsurfaceio Plotly template and patch Plotly Express once.

register_template

register_template() -> None

Register the module Plotly template without changing the global default.

Idempotent: safe to call multiple times. Does not set plotly.io.templates.default.

Call once at application startup.