Allow copying an image result from Python Interactive window
See original GitHub issueEnvironment data
- VS Code version: 1.30.2
- Extension version (available under the Extensions sidebar): 2018.12.1
- OS and version: Ubuntu 18.04
- Python version (& distribution if applicable, e.g. Anaconda): Anaconda Python 3.7.2
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
- Relevant/affected Python packages and their versions: None
Expected behaviour
It’d be great if Python plots within the IDE could be copied to the clipboard. I’d expect right-click to show a menu with “Copy” as an option, for example.
Copying pasting quick plots into Slack/e-mail is super convenient for sharing intermediate results with colleagues.
Actual behaviour
Copying code from Python Interactive works (including rich formatting), but copying images does not. Right-clicking on the image does not show a menu. Selecting the image as part of the surrounding code does not include the image.
Workaround: Take screenshot, paste into image editor, crop, copy-paste the crop, close image editor.
Steps to reproduce:
- Paste this into a .py script
#%%
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
plt.plot(x, np.sin(x))
- Click “Run Cell” in the editor.
- Try to copy the resulting plot to the clipboard.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:44
- Comments:32 (15 by maintainers)
Top Results From Across the Web
Python interactive window (REPL) - Visual Studio
First, switch to the Python Environments window (View > Other Windows > Python Environments or Ctrl+K > Ctrl+`) and select the Open Interactive...
Read more >How to save images from Python Interactive tab in Microsoft ...
But the answer here is that we don't have a way to do this currently. You can highlight it in the interactive window...
Read more >Working with Jupyter code cells in the Python Interactive window
Working with Jupyter code cells in the Python Interactive window. ... with the token typically appears in the terminal output from where you...
Read more >Chapter 17 – Manipulating Images
Figure 17-3 is the image that will be used for all the interactive shell ... Despite their names, the copy() and paste() methods...
Read more >Changelog — Python 3.11.1 documentation
gh-95191: Include prompts when saving Shell (interactive input and output). gh-95511: Fix the Shell context menu copy-with-prompts bug of copying an extra line ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I didn’t want to create a new issue, but it appears some of the functionality discussed herein is further broken in the new vs code notebooks. Also, my main way of using plots before, dragging them out of vs code directly into powerpoint, no longer works. I must drag them into a windows explorer folder and then into powerpoint.
It’s 2021, it would be good to be able to copy the figures from the interactive figure viewer…