Saving plots to desktop

Question:
How do I save a plot from my code to my desktop while using replit?

Replit Profile: https://replit.com/@ralphd2

What do you mean by “plot”?

2 Likes

A graph. I use the plt.figure() function to create a plot. I wanted to save the figure without having to screenshot it.

1 Like

You can use
plt.savefig("desiredname.png")
to save an image of your plot to your repl and then from there you could download it to your desktop.
I put it just before plt.show() and it worked fine.

2 Likes

Thank you so much. This should make the process a lot easier.

2 Likes

Please mark this post as the solution.

2 Likes

Hello again, @ralphd2.
Another way which you can save the plots, though plt.savefig("name.png")may be easier, is to first stretch open the output window until you can see the controls at the bottom,


by default the output window may not display these.

Then click the save button

,

it’ll then bring up by default the home/runner directory
look for your repl’s name

Then, within that folder you can save the file as you wish

and then it should appear in your file tree, where again you can download it to your desktop. This way may add a few extra steps but could offer more versatility.

As a side note, if you experience issues with the output not working, as some other users have been reporting, consider using the Python Data Science template instead of the normal python one.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.