pyoptools.gui.plotly_viewer module

Interactive 3D visualization for pyOpTools optical systems using Plotly.

Provides a modern, universal WebGL 3D viewer compatible with Marimo, JupyterLab 4, VS Code Interactive Window, and standalone HTML exports.

pyoptools.gui.plotly_viewer.plot_system_plotly(obj: Any, title: str = 'Optical System (3D View)', dark_mode: bool = False, width: int = 900, height: int = 550, camera_eye: dict[str, float] | None = None, show_rays: bool = True, ray_width: int = 4) → Any

Creates an interactive 3D WebGL visualization of an optical system using Plotly.

Parameters:
  • obj – pyOpTools System, Component, Surface, Ray, or list of Rays to visualize.

  • title – Title of the visualization plot.

  • dark_mode – If True, uses dark background theme.

  • width – Plot width in pixels.

  • height – Plot height in pixels.

  • camera_eye – Optional dictionary with ‘x’, ‘y’, ‘z’ camera viewpoint coordinates.

  • show_rays – Whether to render rays.

  • ray_width – Width of the ray lines in pixels.

Returns:

plotly.graph_objects.Figure ready to display in Marimo, Jupyter, or export to HTML.