-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
49 lines (42 loc) · 1.25 KB
/
utils.py
File metadata and controls
49 lines (42 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import plotly.graph_objects as go
def create_flight_path_plot(path_coords, area_width, area_height):
"""Create a Plotly figure showing the flight path"""
x_coords, y_coords = zip(*path_coords)
fig = go.Figure()
# Add flight path
fig.add_trace(go.Scatter(
x=x_coords,
y=y_coords,
mode='lines+markers',
name='Flight Path',
line=dict(color='blue', width=2),
marker=dict(size=6)
))
# Add start point
fig.add_trace(go.Scatter(
x=[x_coords[0]],
y=[y_coords[0]],
mode='markers',
name='Start',
marker=dict(size=12, color='green', symbol='star')
))
# Add end point
fig.add_trace(go.Scatter(
x=[x_coords[-1]],
y=[y_coords[-1]],
mode='markers',
name='End',
marker=dict(size=12, color='red', symbol='square')
))
# Update layout
fig.update_layout(
title="Flight Path Visualization",
xaxis_title="Distance (meters)",
yaxis_title="Distance (meters)",
showlegend=True,
xaxis=dict(range=[-10, area_width + 10]),
yaxis=dict(range=[-10, area_height + 10]),
xaxis_scaleanchor="y",
xaxis_scaleratio=1,
)
return fig