My code is succesfully saving images to file, but it is cropping important details from the right hand side. Answers exist for fixing this problem when it arises for plt.show
, but it is the savefig
command that is incorrectly producing the graph in this example. How can this be fixed?
The relevant sample of my code:
import glob
import os
for file in glob.glob("*.oax"):
try:
spc_file = open(file, 'r').read()
newName = file[6:8] + '-' + file[4:6] + '-' + file[0:4] + ' ' + file[8:12] + ' UTC (Observed) - No Sea Breeze Day'
plt.title(newName, fontsize=12, loc='left')
plt.savefig('X:/' + newName + '.png')
plt.show()
except Exception:
pass
And the images (top is plt.show
and bottom is file produced from savefig
: