@@ -25,7 +25,7 @@ def plot_routes(solution, plot_base_name):
25
25
ymin = min (first_start [1 ], first_end [1 ])
26
26
ymax = ymin
27
27
28
- vehicles_have_same_start_end = True
28
+ vehicles_have_same_start_end = ( len ( solution [ "routes" ]) > 1 )
29
29
for route in solution ["routes" ]:
30
30
current_start = route ["steps" ][0 ]["location" ]
31
31
current_end = route ["steps" ][- 1 ]["location" ]
@@ -48,10 +48,19 @@ def plot_routes(solution, plot_base_name):
48
48
49
49
ax1 .plot (lons , lats , color = color_list [route ["vehicle" ] % len (color_list )])
50
50
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
+ # )
55
64
56
65
step = route ["steps" ][- 1 ]
57
66
if step ["type" ] == "end" :
0 commit comments