Coverage for src/min_circle/utils/figure.py: 100%
5 statements
« prev ^ index » next coverage.py v7.10.4, created at 2025-08-19 00:41 +0000
« prev ^ index » next coverage.py v7.10.4, created at 2025-08-19 00:41 +0000
1"""Figure utility module for creating and configuring Plotly figures.
3This module provides functions for creating pre-configured Plotly figures
4for visualizing circles and point clouds.
5"""
7import plotly.graph_objects as go
10def create_figure() -> go.Figure:
11 """Create a pre-configured Plotly figure with equal aspect ratio.
13 Creates a new Plotly figure with an equal aspect ratio between x and y axes,
14 which is important for correctly visualizing circles.
16 Returns:
17 A configured Plotly Figure object ready for adding traces
18 """
19 # Create an empty figure
20 fig = go.Figure()
22 # Update layout for equal aspect ratio and axis labels
23 fig.update_layout(
24 xaxis_title="x",
25 yaxis_title="y",
26 # Ensure equal scaling for x and y axes (important for circles)
27 yaxis=dict(
28 scaleanchor="x",
29 scaleratio=1,
30 ),
31 )
33 return fig