spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.37k stars 1.62k forks source link

Copying image generates horizontal bar #20215

Open OverLordGoldDragon opened 1 year ago

OverLordGoldDragon commented 1 year ago

Copy-pasted output of plt.plot([1, 2]):

image

If I first paste into MS Paint, make no changes at all (even not reselecting with Ctrl+A), then copy from there, then it disappears. Reproduced with both, copying from inline IPython console and Plots pane, with Completion: Graphical and Backend: Inline. This has been the case since Spyder 4.

Windows 10, spyder 5.4.0, other info here.

dalthviz commented 1 year ago

Hi @OverLordGoldDragon , I'm not totally sure to follow what you mean. Where is the horizontal bar you mention being generated? in the plot that you are copying? Also, could you check if this is happening when using the ipython console outside Spyder?

Any other info to better understand what is happening is greatly appreciated!

OverLordGoldDragon commented 1 year ago

I don't seem to have a copy option in ipython -- here's ~demo.mp4~

OverLordGoldDragon commented 1 year ago

Video compressor cropped the video..? here's corrected

dalthviz commented 1 year ago

Oh, thanks for the video! I was unable to notice the line since my GitHub interface uses the dark theme 😅 :

image

With the light theme:

image

Are you setting any specific config from Spyder Inline backend options or with rcParams? Could you try to update matplotlib to 3.6.2 and check again? Tried running locally the following with Mute inline plotting disabled:

import matplotlib.pyplot as plt
plt.plot([1, 2])

and I got:

image

OverLordGoldDragon commented 1 year ago

Upgraded to 3.6.2, restarted Spyder, no change. Not setting rcParams - here's Spyder configs:

image

image

image

Btw, also reproduced by copying from Plots pane. I tried Automatic backend then Save, it's not reproduced there, nor if I try to save the inline output instead of copying it.

dalthviz commented 1 year ago

I was able to reproduce this with the Inline backend config you have:

imagen

No idea what could be causing this 🤔 Do you have any idea why this could be happening @ccordoba12 ?

ccordoba12 commented 1 year ago

Perhaps this is caused by the Use a tight layout for inline plots option.

OverLordGoldDragon commented 1 year ago

Reproduced without Use a tight layout for inline plots

image

OverLordGoldDragon commented 1 year ago

I just discovered that it's not reproduced with Chrome or Microsoft Edge browsers. I'm using Firefox Developer Edition 114.0b3 (64-bit).