Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save images from Python Interactive tab in Microsoft Visual Studio Code

I am using the Python Interactive tab (similar to Jupyter notebooks) in Microsoft Visual Studio Code.

When I plot an image, I am unable to save it directly from the editor. There's no option to save it directly with the mouse, or to save it directly from the interface.

Is there a way to save it from the interface or should I only use matplotlib's savefig method?

like image 352
gc5 Avatar asked Feb 28 '19 16:02

gc5


2 Answers

In my version (1.47.3) I can double click the image, which opens it in a separate tab for inspection.

One of the buttons in this tab is a save icon, which allows you to save the image in a format that depends on the file ending you choose. I've tried .png, but couldn't find an option to change resolution. .pdf or .svg saves it losslessly as vector graphic.

In the image below you can see what it looks like for me. (on Ubuntu) screenshot of multiple tabs

like image 149
Daniel Avatar answered Sep 29 '22 04:09

Daniel


Not fully sure if this counts as a full answer here on Stack Overflow. But the answer here is that we don't have a way to do this currently. You can highlight it in the interactive window and Ctrl-C to copy it out, but even that support is rather flakey at this point. If you would like to log this issue this would be the best spot to get it on our radar: https://github.com/Microsoft/vscode-python/issues We keep our issues open to the public so you can track when we work on it after it's filed there.

like image 36
Ian Huff Avatar answered Sep 29 '22 02:09

Ian Huff