eaglelandsonce commited on
Commit
a8536b2
1 Parent(s): 8bb3175

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +16 -0
app2.py CHANGED
@@ -75,6 +75,7 @@ def draw_grid(data):
75
  ax.text(coords[1]+0.5*size, nrows-coords[0]-0.5*size, b_type, ha='center', va='center', fontsize=8, color='black')
76
 
77
  # Draw roads
 
78
  for road in data.get('roads', []): # Check for roads in the data, default to empty list if not found
79
  start, end = road['start'], road['end']
80
  # Determine if the road is vertical or horizontal based on start and end coordinates
@@ -84,6 +85,21 @@ def draw_grid(data):
84
  else: # Horizontal road
85
  for x in range(min(start[0], end[0]), max(start[0], end[0]) + 1):
86
  ax.add_patch(plt.Rectangle((x, nrows-start[1]-1), 1, 1, color=road['color']))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
 
89
  # Reverse the y-axis numbers
 
75
  ax.text(coords[1]+0.5*size, nrows-coords[0]-0.5*size, b_type, ha='center', va='center', fontsize=8, color='black')
76
 
77
  # Draw roads
78
+ """
79
  for road in data.get('roads', []): # Check for roads in the data, default to empty list if not found
80
  start, end = road['start'], road['end']
81
  # Determine if the road is vertical or horizontal based on start and end coordinates
 
85
  else: # Horizontal road
86
  for x in range(min(start[0], end[0]), max(start[0], end[0]) + 1):
87
  ax.add_patch(plt.Rectangle((x, nrows-start[1]-1), 1, 1, color=road['color']))
88
+ """
89
+
90
+
91
+ # Draw roads with a specified grey color
92
+ road_color = "#A0A0A0" # Light grey; change to "#505050" for dark grey
93
+ for road in data.get('roads', []): # Check for roads in the data
94
+ start, end = road['start'], road['end']
95
+ # Determine if the road is vertical or horizontal based on start and end coordinates
96
+ if start[0] == end[0]: # Vertical road
97
+ for y in range(min(start[1], end[1]), max(start[1], end[1]) + 1):
98
+ ax.add_patch(plt.Rectangle((start[0], nrows-y-1), 1, 1, color=road_color))
99
+ else: # Horizontal road
100
+ for x in range(min(start[0], end[0]), max(start[0], end[0]) + 1):
101
+ ax.add_patch(plt.Rectangle((x, nrows-start[1]-1), 1, 1, color=road_color))
102
+
103
 
104
 
105
  # Reverse the y-axis numbers