Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Created April 23, 2021 14:55
Show Gist options
  • Select an option

  • Save samirsaci/fcfaf197c80c9ab422df6c6f8389d9f3 to your computer and use it in GitHub Desktop.

Select an option

Save samirsaci/fcfaf197c80c9ab422df6c6f8389d9f3 to your computer and use it in GitHub Desktop.
Plot solution rectpack
def plot_solution(all_rects, pal_812, pal_1012):
# Plot
plt.figure(figsize=(10,10))
# Loop all rect
for rect in all_rects:
b, x, y, w, h, rid = rect
x1, x2, x3, x4, x5 = x, x+w, x+w, x, x
y1, y2, y3, y4, y5 = y, y, y+h, y+h,y
# Pallet type
if [w, h] == pal_812:
color = '--k'
else:
color = '--r'
plt.plot([x1,x2,x3,x4,x5],[y1,y2,y3,y4,y5], color)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment