from ..Qt import QtGui, QtCore, USE_PYSIDE
import matplotlib

if USE_PYSIDE: 
    matplotlib.rcParams['backend.qt4']='PySide'

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
from matplotlib.figure import Figure

class MatplotlibWidget(QtGui.QWidget):
    """
    Implements a Matplotlib figure inside a QWidget.
    Use getFigure() and redraw() to interact with matplotlib.
    
    Example::
    
        mw = MatplotlibWidget()
        subplot = mw.getFigure().add_subplot(111)
        subplot.plot(x,y)
        mw.draw()
    """
    
    def __init__(self, size=(5.0, 4.0), dpi=100):
        QtGui.QWidget.__init__(self)
        self.fig = Figure(size, dpi=dpi)
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(self)
        self.toolbar = NavigationToolbar(self.canvas, self)
        
        self.vbox = QtGui.QVBoxLayout()
        self.vbox.addWidget(self.toolbar)
        self.vbox.addWidget(self.canvas)
        
        self.setLayout(self.vbox)

    def getFigure(self):
        return self.fig
        
    def draw(self):
        self.canvas.draw()

@@ -35,16 +35,27 @@
 E_PYSIDE
+, USE_PYQT5
 %0Aimport 
@@ -66,16 +66,38 @@
 lotlib%0A%0A
+if not USE_PYQT5:%0A    
 if USE_P
@@ -102,18 +102,21 @@
 _PYSIDE:
- 
 %0A
+    
     matp
@@ -156,16 +156,20 @@
 ySide'%0A%0A
+    
 from mat
@@ -241,16 +241,20 @@
 eCanvas%0A
+    
 from mat
@@ -337,16 +337,201 @@
 Toolbar%0A
+else:%0A    from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas%0A    from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar%0A%0A
 from mat

Add pyqt5 support for MatplotlibWidget