how to stop creating new frame in plot pane for each matplotlib.pyplot command?
See original GitHub issueThis is not a bug report or a feature request, I don’t think. It’s more of a usage help question. If creating an issue here isn’t the right way to get help, my apologies in advance-- direct me to where I should ask.
I would like to be able to add graphic items to an existing figure in a frame of the plots pane, without a new frame appearing there each time I execute a matplotlib.pyplot command.
I undock the plot pane (which btw, other than the confusion I am describing here, I find very helpful!) and run this code:
import matplotlib.pyplot as plt
plt.figure()
At this point there is no frame in the plot pane yet.
(Not sure why-- for this first plt.figure()
command I guess I would need to do plt.show()
to make it appear?)
Anyway, then I do plt.axes()
and now there is a frame in the plot pane:
Then I do plt.plot(range(10))
with the intent to insert a line in to the existing frame.
However, what happens is not as intended-- a second frame appears in the plot pane:
Next I want to add a text item to the existing frame so I run plt.text(0.5,0.5,'Text Item')
and once again, contrary to my goal, a new (third) frame appears withiin the plot pane (showing only the text item in it):
So the bottom line is that apparently I am not properly understanding how to control when plt.show()
does or doesn’t execute.
I searched the issues and saw a lot of questions about turning inline plots on and off but this topic seems different. I also looked at the documentation for the plots pane and didn’t find info that would help me out on this.
Thanks in advance to anybody who can bring me up to speed on this!
- Spyder version: 5.4.0 (conda)
- Python version: 3.8.13 64-bit
- Qt version: 5.15.6
- PyQt5 version: 5.15.7
- Operating System: Windows 10
DEPENDENCIES
Mandatory:
atomicwrites >=1.2.0 : 1.4.1 (OK) chardet >=2.0.0 : 5.1.0 (OK) cloudpickle >=0.5.0 : 2.2.0 (OK) cookiecutter >=1.6.0 : 2.1.1 (OK) diff_match_patch >=20181111 : 20200713 (OK) intervaltree >=3.0.2 : 3.0.2 (OK) IPython >=7.31.1;<8.0.0 : 7.33.0 (OK) jedi >=0.17.2;<0.19.0 : 0.18.2 (OK) jellyfish >=0.7 : 0.9.0 (OK) jsonschema >=3.2.0 : 4.17.3 (OK) keyring >=17.0.0 : 23.11.0 (OK) nbconvert >=4.0 : 7.2.5 (OK) numpydoc >=0.6.0 : 1.5.0 (OK) paramiko >=2.4.0 : 2.12.0 (OK) parso >=0.7.0;<0.9.0 : 0.8.3 (OK) pexpect >=4.4.0 : 4.8.0 (OK) pickleshare >=0.4 : 0.7.5 (OK) psutil >=5.3 : 5.9.4 (OK) pygments >=2.0 : 2.13.0 (OK) pylint >=2.5.0;❤️.0 : 2.15.7 (OK) pylint_venv >=2.1.1 : 2.3.0 (OK) pyls_spyder >=0.4.0 : 0.4.0 (OK) pylsp >=1.6.0;<1.7.0 : 1.6.0 (OK) pylsp_black >=1.2.0 : 1.2.1 (OK) qdarkstyle >=3.0.2;❤️.1.0 : 3.0.3 (OK) qstylizer >=0.2.2 : 0.2.2 (OK) qtawesome >=1.2.1 : 1.2.1 (OK) qtconsole >=5.4.0;<5.5.0 : 5.4.0 (OK) qtpy >=2.1.0 : 2.3.0 (OK) rtree >=0.9.7 : 1.0.1 (OK) setuptools >=49.6.0 : 65.5.1 (OK) sphinx >=0.6.6 : 5.3.0 (OK) spyder_kernels >=2.4.0;<2.5.0 : 2.4.0 (OK) textdistance >=4.2.0 : 4.5.0 (OK) three_merge >=0.1.1 : 0.1.1 (OK) watchdog >=0.10.3 : 2.1.9 (OK) zmq >=22.1.0 : 24.0.1 (OK)
Optional:
cython >=0.21 : None (NOK) matplotlib >=3.0.0 : 3.6.0 (OK) numpy >=1.7 : 1.23.3 (OK) pandas >=1.1.1 : 1.5.0 (OK) scipy >=0.17.0 : 1.9.1 (OK) sympy >=0.7.3 : None (NOK)
Issue Analytics
- State:
- Created 9 months ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
ok thanks @dalthviz !
Yes. I’m in a more comfortable place now.
Just to confirm though, there is no command I can execute at the commandline in the ipython console that would delete one of the frames within the plots pane, correct? The only way to do this is to click the ‘delete’ (trashcan) button on the plots pane, right?