agregar barra de desplazamiento en matplotlib

0

Quiero usar la biblioteca matplotlib para mostrar varios gráficos agregando una barra de desplazamiento para mostrar estos gráficos haciendo clic en el botón pulsador. Pero al hacer clic en el botón pulsador, aparece un error de este tipo: QCoreApplication :: exec: El bucle de eventos ya se está ejecutando . Agradezco su ayuda.

import matplotlib
# Make sure that we are using QT5
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
from PyQt5 import QtWidgets
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(30, 60, 75, 23))
        self.pushButton.setObjectName("pushButton")
        self.pushButton.clicked.connect(self.ShowChart)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "Form"))
        self.pushButton.setText(_translate("Form", "PushButton"))

    def ShowChart(self):
        class ScrollableWindow(QtWidgets.QMainWindow):
            def __init__(self, fig):
                self.qapp = QtWidgets.QApplication([])

                QtWidgets.QMainWindow.__init__(self)
                self.widget = QtWidgets.QWidget()
                self.setCentralWidget(self.widget)
                self.widget.setLayout(QtWidgets.QVBoxLayout())
                self.widget.layout().setContentsMargins(0,0,0,0)
                self.widget.layout().setSpacing(0)

                self.fig = fig
                self.canvas = FigureCanvas(self.fig)
                self.canvas.draw()
                self.scroll = QtWidgets.QScrollArea(self.widget)
                self.scroll.setWidget(self.canvas)

                self.nav = NavigationToolbar(self.canvas, self.widget)
                self.widget.layout().addWidget(self.nav)
                self.widget.layout().addWidget(self.scroll)

                self.show()
                exit(self.qapp.exec_()) 
        # create a figure and some subplots
        fig, axes = plt.subplots(ncols=4, nrows=5, figsize=(16,16))
        for ax in axes.flatten():
            ax.plot([2,3,5,1])

        # pass the figure to the custom window
        a = ScrollableWindow(fig)


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Form = QtWidgets.QWidget()
    ui = Ui_Form()
    ui.setupUi(Form)
    Form.show()
    sys.exit(app.exec_())