Reputation: 173
i got these line of codes, and i want to save the figure to an specific folder.
images = r"C:\Users\danie\Desktop\test"
plt.savefig( images + "test"+ ".png")
could anyone help me, why matplotlib is saving the figure to the Desktop but not in the folder, that's given in the path ?
Upvotes: 1
Views: 1311
Reputation:
You have forgotten to put a \
after folder test
. When you substitute the image path, you will get something like C:\Users\danie\Desktop\testtest.png"
. So now python thinks that the image should be saved as C:\Users\danie\Desktop\testtest.png"
which you don't want. You want C:\Users\danie\Desktop\test\test.png"
Solution:
Just add a \
after test
images = r"C:\Users\danie\Desktop\test\"
plt.savefig( images + "test"+ ".png")
Upvotes: 2