geolatent.rendering.scene#

3-D scene manager for geolatent.

Scene3D wraps a Plotly go.Figure and manages:

  • Application of the dark-scientific theme to every layout property.

  • A fluent add_trace / add_traces interface that returns self for method chaining.

  • Camera positioning, axis labelling, and annotation injection.

  • The render() finalisation step that returns the completed figure.

The scene is intentionally decoupled from domain logic (decision surfaces, scatter overlays, etc.) to keep the rendering layer independently testable and reusable.

Classes#

Scene3D

Stateful 3-D Plotly figure builder with dark-scientific theming.

Module Contents#

class geolatent.rendering.scene.Scene3D(config: geolatent.config.themes.VisualizationConfig)[source]#

Stateful 3-D Plotly figure builder with dark-scientific theming.

Parameters:

config (VisualizationConfig) – Master configuration; theme colours, render sizes, and camera settings are all read from here.

Examples

>>> scene = Scene3D(DARK_SCIENTIFIC)
>>> scene.add_trace(some_trace).add_trace(another_trace)
>>> fig = scene.render()
>>> fig.show()
config#
add_trace(trace: plotly.graph_objects.BaseTraceType) Scene3D[source]#

Add a single Plotly trace.

Parameters:

trace (go.BaseTraceType)

Return type:

self

add_traces(traces: Sequence[plotly.graph_objects.BaseTraceType]) Scene3D[source]#

Add multiple Plotly traces at once.

Parameters:

traces (sequence of go.BaseTraceType)

Return type:

self

set_title(title: str) Scene3D[source]#

Set the figure title.

Parameters:

title (str)

Return type:

self

set_axis_labels(labels: List[str]) Scene3D[source]#

Override the three axis labels.

Parameters:

labels (list of 3 str)

Return type:

self

add_variance_annotation(explained_variance_ratio: object) Scene3D[source]#

Append a cumulative explained-variance annotation.

Parameters:

explained_variance_ratio (array-like of shape (3,)) – Per-component explained-variance ratios from PCA.

Return type:

self

add_text_annotation(text: str, *, x: float = 0.99, y: float = 0.99) Scene3D[source]#

Add a free-form text annotation in paper coordinates.

Parameters:
  • text (str) – HTML-formatted annotation text.

  • x (float) – Paper-coordinate position (0–1).

  • y (float) – Paper-coordinate position (0–1).

Return type:

self

render() plotly.graph_objects.Figure[source]#

Apply the dark-scientific layout and return the completed figure.

Returns:

fig – A fully configured Plotly figure ready for fig.show() or fig.write_html().

Return type:

go.Figure