Skip to content

Allow copying an image result from Python Interactive window #1470

@andrewdelong

Description

@andrewdelong

Environment 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:

  1. 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))
  1. Click "Run Cell" in the editor.
  2. Try to copy the resulting plot to the clipboard.

Metadata

Metadata

Labels

feature-requestRequest for new features or functionalityinteractive-windowImpacts interactive windownotebook-workflowIssues that interrupt expected or desirable behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions