spyder-ide / spyder

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

Viewing older plots drags you down to the newly made plots while the code is running #21683

Open Chuck321123 opened 8 months ago

Chuck321123 commented 8 months ago

Issue Report Checklist

Checklist checked

Problem Description

So I have a code that print many plots and im interested in checking the first plots while the code is still running, but suddenly im dragged down to the newly printed plot. I scroll back up to see the plot i was interested in, and 2 seconds later im getting dragged down to the latest plot again. This is a bit annoying in the long term. A solution would be that Spyder doesnt drag you down to the latest plot if you dont stand on the latest plot already

What steps reproduce the problem?


import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import time

# Set a seed for reproducibility
np.random.seed(42)

# Create a Pandas DataFrame with 15 columns and 100 rows
num_rows = 100
num_columns = 20

data = {f'Col{i}': np.random.rand(num_rows) for i in range(1, num_columns + 1)}
df = pd.DataFrame(data)

# Plot each column in a loop, showing one plot at a time
for i in range(num_columns):
    column_name = f'Col{i+1}'
    plt.figure(figsize=(10, 6))
    plt.plot(df[column_name])
    plt.title(column_name)
    plt.xlabel('Row Index')
    plt.ylabel('Random Value')
    plt.show()

    if i >= 9:

        time.sleep(4)

What is the expected output?

That i dont get dragged down to the newly printed plot if i stand on an older plot while a code is running

Versions

Dependencies

# Mandatory:
atomicwrites >=1.2.0             :  1.4.1 (OK)
chardet >=2.0.0                  :  5.2.0 (OK)
cloudpickle >=0.5.0              :  3.0.0 (OK)
cookiecutter >=1.6.0             :  2.5.0 (OK)
diff_match_patch >=20181111      :  20230430 (OK)
intervaltree >=3.0.2             :  3.1.0 (OK)
IPython >=8.13.0,<9.0.0,!=8.17.1 :  8.19.0 (OK)
jedi >=0.17.2,<0.20.0            :  0.19.1 (OK)
jellyfish >=0.7                  :  1.0.3 (OK)
jsonschema >=3.2.0               :  4.20.0 (OK)
keyring >=17.0.0                 :  24.3.0 (OK)
nbconvert >=4.0                  :  7.13.1 (OK)
numpydoc >=0.6.0                 :  1.6.0 (OK)
paramiko >=2.4.0                 :  3.4.0 (OK)
parso >=0.7.0,<0.9.0             :  0.8.3 (OK)
pexpect >=4.4.0                  :  4.9.0 (OK)
pickleshare >=0.4                :  0.7.5 (OK)
psutil >=5.3                     :  5.9.7 (OK)
pygments >=2.0                   :  2.17.2 (OK)
pylint >=2.5.0,<3.1              :  3.0.3 (OK)
pylint_venv >=3.0.2              :  3.0.3 (OK)
pyls_spyder >=0.4.0              :  0.4.0 (OK)
pylsp >=1.9.0,<1.10.0            :  1.9.0 (OK)
pylsp_black >=1.2.0,<3.0.0       :  2.0.0 (OK)
qdarkstyle >=3.2.0,<3.3.0        :  3.2.3 (OK)
qstylizer >=0.2.2                :  0.2.2 (OK)
qtawesome >=1.2.1                :  1.3.0 (OK)
qtconsole >=5.5.0,<5.6.0         :  5.5.1 (OK)
qtpy >=2.1.0                     :  2.4.1 (OK)
rtree >=0.9.7                    :  1.1.0 (OK)
setuptools >=49.6.0              :  68.2.2 (OK)
sphinx >=0.6.6                   :  7.2.6 (OK)
spyder_kernels >=2.5.0,<2.6.0    :  2.5.0 (OK)
textdistance >=4.2.0             :  4.6.1 (OK)
three_merge >=0.1.1              :  0.1.1 (OK)
watchdog >=0.10.3                :  3.0.0 (OK)
zmq >=22.1.0                     :  25.1.2 (OK)

# Optional:
cython >=0.21                    :  None (NOK)
matplotlib >=3.0.0               :  3.8.2 (OK)
numpy >=1.7                      :  1.26.2 (OK)
pandas >=1.1.1                   :  2.1.4 (OK)
scipy >=0.17.0                   :  1.11.4 (OK)
sympy >=0.7.3                    :  None (NOK)
ccordoba12 commented 8 months ago

Hey @Chuck321123, thanks for reporting. This looks like a bothersome usability issue that shouldn't be that hard to fix.

@jitseniesen, would you like to take a look at this one for Spyder 6 given that you're reviewing several issues of the Plots pane?

jitseniesen commented 8 months ago

@jitseniesen, would you like to take a look at this one for Spyder 6 given that you're reviewing several issues of the Plots pane?

Yes, I'll put it on my to do list. It is a nice suggestion.