Reputation: 473
This question seems really easy, but I could not figure that out. I want to save a jpg file. I used plt.savefig(fileName)
. I also create a new folder using import os
and then os.mkdir('D:\Users\data')
. Now, I want to put this figure into this created folder. Thanks in advance ...
Upvotes: 1
Views: 4552
Reputation: 65791
Just pass the full path to savefig
.
folderName = 'D:/Users/data'
os.makedirs(folderName)
plt.savefig(os.path.join(folderName, fileName))
Upvotes: 3