Exemple #1
0
 def __init__(self, parent=None):
     """Initialize widget and add figure canvas."""
     super(MplWidget, self).__init__(parent)
     self.canvas = MplCanvas()
     self.vbl = _QVBoxLayout()
     self.vbl.addWidget(self.canvas)
     self.toolbar = _Toolbar(self.canvas, self)
     self.vbl.addWidget(self.toolbar)
     self.setLayout(self.vbl)
Exemple #2
0
    def __init__(self, parent=None):
        """Add figure canvas to layout."""
        super().__init__(parent)

        self.figure = _Figure()
        self.canvas = _FigureCanvas(self.figure)
        self.ax = self.figure.add_subplot(111)

        _layout = QtWidgets.QVBoxLayout()
        _layout.addWidget(self.canvas)
        self.toolbar = _Toolbar(self.canvas, self)
        _layout.addWidget(self.toolbar)
        self.setLayout(_layout)