0

I am trying to compute an image with points plotted on it, and it seems to work well when I am showing it :

fig = plt.figure(figsize=(18, 18))

ax = fig.add_subplot(222)
img = imageio.imread(stim_dir + image_name)

# Code to plot points

plt.title("fixation points of " + file_name)
plt.show()

It shows me the image I want, no worries. However, if I just add to this code

plt.savefig(result_dir + file_name + ".png", bbox_inches='tight')

Then it saves the image to the right folder, but it is all blank, without any title, any image, any points. Just blank. What could go wrong ?

Sanimys
  • 101
  • 1
  • 10

1 Answers1

3

You can change the order of plt.savefig(result_dir + file_name + ".png", bbox_inches='tight') and plt.show(). So if you first save the image and then show it, the saved image should not be blank anymore.

Koralp Catalsakal
  • 1,114
  • 8
  • 11