yt-project / yt

Main yt repository
http://yt-project.org
Other
469 stars 280 forks source link

Save the image to a specified location #5030

Open Z-joe7 opened 4 weeks ago

Z-joe7 commented 4 weeks ago

I‘m using the yt project to visual my hdf5 data, this tool is absolutely handy! But I don't know how to save the pic to a specified location, can I ask for your guidance?

    for item in files[1:] 

            path = str(item)
            ds = yt.load(path)
            p = yt.ProjectionPlot(ds, "z", "density")
            p.save()      #I want to specify a location in here
welcome[bot] commented 4 weeks ago

Hi, and welcome to yt! Thanks for opening your first issue. We have an issue template that helps us to gather relevant information to help diagnosing and fixing the issue.

neutrinoceros commented 4 weeks ago

Hi ! You should be able to specify a either a complete path as the first argument to save or just a directory, in which case the filename will be automatically generated. Does this answer your question ?

Z-joe7 commented 4 weeks ago

Thank fou your reply! But maybe I don't describe the question clearly. I want to save all my pics to a pecified location because now they just save at the work directory, how should transmit the parameter?

neutrinoceros commented 4 weeks ago

p.save("any/path/you/like")