I use plt.savefig(pngpath, dpi=300)
, where the pngpath is the path where I want it to save. The png file as such is being created but is blank when I try and open it. Interestingly, the plt.show()
right before this plt.savefig()
works perfectly fine.
EDIT 1: As ONDRO pointed out, I used plt.show() after plt.savefig() and the plot saved perfectly as intended. Also, I will make sure to add minimal reproduceable code next time. Thank you ONDRO and everyone else for helping me out!