I have been trying to save multiple plots with different names through a loop.
I am looking for the Julia equivalent of python script: plt.savefig('ID+str(i).‘png’).
I tested this savefig(“C:/Julia_data/ID”+str(i) “.pdf”) but obviously it does work.
In Julia you concatenate strings with *
, not +
.
It would be helpful for you to post the error message so we can confirm this is your problem.
I would also recommend using joinpath
to create a path. It’s more robust if you want your code to run on multiple operating systems and I find it to be a good habit.
path = raw“C:\Julia_data”
savefig(joinpath(path,"ID" * str(i) * “.pdf”))
2 Likes