want to save python matplotlib output to my local folder in computer
my code
fig = plot.figure(figsize=(30, 30))
outer = gridspec.GridSpec(5, 5, wspace=0.2, hspace=0.2)
for i in range(5):
inner = gridspec.GridSpecFromSubplotSpec(2, 1,subplot_spec=outer[i], wspace=0.1, hspace=0.1)
#rnd_number = randint(0,len(pred_images)) # for random output
rnd_number = i
pred_image = np.array([pred_images[rnd_number]])
#pred_image = np.array(pred_images)
pred_class = get_classlabel(loaded_model.predict_classes(pred_image)[0])
pred_prob = loaded_model.predict(pred_image).reshape(6)
for j in range(2):
if (j%2) == 0:
ax = plot.Subplot(fig, inner[j])
ax.imshow(pred_image[0])
ax.set_title(pred_class)
ax.set_xticks([])
ax.set_yticks([])
fig.add_subplot(ax)
else:
ax = plot.Subplot(fig, inner[j])
ax.bar([0,1,2,3,4,5],pred_prob)
fig.add_subplot(ax)
plot.figure(figsize=(15,15))
#fig.show()
after executing the above code
now i want output to save it on computer in particular folder
1 image along with its graphs ie under it in 1 jpg file 2 image along with its graphs ie under it in 2 jpg file
in same i want it to do for all image