PySide instead of PyQt4 as a prerequisite for using matplotlib Qt4Agg

I have a quick question regarding the premise of using Qt4Agg backend with matplotlib. In the documentation , he said that Qt4Agg requires PyQt4. However, since matplotlib can now work fine with PySide instead of PyQt4, can I install PySide only? Do I still need to install PyQt4 to allow matplotlib to work with Pyside?

I ask this question because in the example of using matplotlib with PySide, the backend must be switched to Qt4Agg and requires PyQt4 according to the documentation.

Thanks!

+4
source share
3

rcparam

backend.qt4 : PySide        # PyQt4 | PySide
+4

Pyside. -

os.environ['QT_API'] = 'pyside' 
from matplotlib import use
use('Qt4Agg') 
import pylab as plt
+1

In addition to the accepted answer, if you do not want to modify the rcParam file:

from matplotlib import rc
rc('backend', qt4="PySide")
0
source

Source: https://habr.com/ru/post/1524809/


All Articles