Description
Bug summary
I tried doing pip install pyside6
and using matplotlib and a chart window appears, but just hangs.
Code for reproduction
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use('QtAgg') # 'QT5Agg' also fails, 'TkAgg' works.
plt.plot([1, 2, 3, 2, 3, 4])
plt.show()
Actual outcome
Chart window opens and hangs.
Expected outcome
Should work the same as when the backend is TkAgg
.
Additional information
I'm running the code in IntelliJ and everything worked fine before I installed Qt.
I'm a newbie and a bit confused as to what exactly I need to do to use Qt as a backend. Note that I'm just exploring/learning, I don't have a reason to want to use Qt over Tk or anything else.
I've read this page on Qt bindings (the text on this page doesn't show up in the actual docs)
And also saw #19255 that seems to add support and was merged and I'm using a later version 3.5.2
.
And I've read this page in the docs and it seems to imply (but not say) that all I need to do is install PySide6 and it should work.
Weirdly, if I just use the code:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 2, 3, 4])
plt.show()
It works, which is weird for two reasons:
- This means that just importing matplotlib invokes different behaviour to importing
matplotlib.pyplot
. - Not importing matplotlib directly (only
pyplot
) results in the message "Backend MacOSX is interactive backend. Turning interactive mode on.". Weird as I'm on Windows, and if I then runplt.get_backend()
it saysQtAgg
. It's all so confusing!
Operating system
Windows 11
Matplotlib Version
3.5.2
Matplotlib Backend
QtAgg, Qt5Agg
Python version
3.10.2
Jupyter version
No response
Installation
pip