Я хочу сохранить графики в массиве, чтобы настроить вид.
def plot_sheet(self):
fig,ax = plt.subplots(1)
ax.set_xlim([0, self.W])
ax.set_ylim([0, self.L])
recs = []
for i in range(len(self.rect_list)):
if self.rect_rotate[i]:
ax.add_patch(patches.Rectangle((self.rect_pos[i][0], self.rect_pos[i][1]), self.rect_list[i].l, self.rect_list[i].w,linewidth=3,edgecolor='r'))
else:
ax.add_patch(patches.Rectangle((self.rect_pos[i][0], self.rect_pos[i][1]), self.rect_list[i].w, self.rect_list[i].l,linewidth=3,edgecolor='r'))
plt.show()
def plot_sheets(self):
fig = plt.figure()
col = math.ceil(len(self.sheets)**0.5)
row = math.ceil(float(len(self.sheets))/col)
gs = gridspec.GridSpec(row, col)
idx = 0
for i in range(row):
for j in range(col):
ax = plt.subplot(gs[i, j])
tmp_sh = self.sheets[idx]
ax.set_xlim([0, tmp_sh.W])
ax.set_ylim([0, tmp_sh.L])
for k in range(len(tmp_sh.rect_list)):
if tmp_sh.rect_rotate[k]:
ax.add_patch(patches.Rectangle((tmp_sh.rect_pos[k][0], tmp_sh.rect_pos[k][1]), tmp_sh.rect_list[k].l, tmp_sh.rect_list[k].w,linewidth=3,edgecolor='r'))
else:
ax.add_patch(patches.Rectangle((tmp_sh.rect_pos[k][0], tmp_sh.rect_pos[k][1]), tmp_sh.rect_list[k].w, tmp_sh.rect_list[k].l,linewidth=3,edgecolor='r'))
idx = idx + 1
if idx == len(self.sheets):
break
plt.show()
plot_sheets строит несколько графиков.
best.plot_sheets()
packing_options[best_index].plot_sheets()
Эти две линии изображают два разных графика. Я хочу хранить графики в массиве для этих двух строк отдельно, чтобы позже использовать графики, чтобы графы появлялись в окне рядом друг с другом. Можно ли это сделать?