Skip to content

Commit 6ed9d2f

Browse files
committedFeb 13, 2025
Merge branch 'enhancement/route-plots'
2 parents 703b21b + 727bee6 commit 6ed9d2f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed
 

‎src/plot.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def plot_routes(solution, plot_base_name):
2525
ymin = min(first_start[1], first_end[1])
2626
ymax = ymin
2727

28-
vehicles_have_same_start_end = True
28+
vehicles_have_same_start_end = (len(solution["routes"]) > 1)
2929
for route in solution["routes"]:
3030
current_start = route["steps"][0]["location"]
3131
current_end = route["steps"][-1]["location"]
@@ -48,10 +48,19 @@ def plot_routes(solution, plot_base_name):
4848

4949
ax1.plot(lons, lats, color=color_list[route["vehicle"] % len(color_list)])
5050

51-
xmin = min(xmin, min(lons))
52-
xmax = max(xmax, max(lons))
53-
ymin = min(ymin, min(lats))
54-
ymax = max(ymax, max(lats))
51+
bbox = [[min(lons), min(lats)], [max(lons), max(lats)]]
52+
53+
xmin = min(xmin, bbox[0][0])
54+
xmax = max(xmax, bbox[1][0])
55+
ymin = min(ymin, bbox[0][1])
56+
ymax = max(ymax, bbox[1][1])
57+
58+
# ax1.plot(
59+
# [bbox[0][0], bbox[1][0], bbox[1][0], bbox[0][0], bbox[0][0]],
60+
# [bbox[0][1], bbox[0][1], bbox[1][1], bbox[1][1], bbox[0][1]],
61+
# linestyle='dotted',
62+
# color=color_list[route["vehicle"] % len(color_list)],
63+
# )
5564

5665
step = route["steps"][-1]
5766
if step["type"] == "end":

0 commit comments

Comments
 (0)
Please sign in to comment.