Created
April 23, 2021 14:55
-
-
Save samirsaci/fcfaf197c80c9ab422df6c6f8389d9f3 to your computer and use it in GitHub Desktop.
Plot solution rectpack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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