-1

I tried saving my matplotlib graph using

plt.savefig('graph.pdf')

Yet, when I open the file it is blank. How can I save my graph properly?

I am doing something similar to this Left Ventricle Bull eye (AHA) matplotlib

cryptofish
  • 89
  • 8

1 Answers1

-1

Try saving in with ".png" extension:

plt.savefig('graph.png')

Also, if you have plt.show() that it will end the instance and there will be nothing to save. Put saving before plt.show().

Andrey Lukyanenko
  • 3,679
  • 2
  • 18
  • 21