FigureWidget.py 717 B

1234567891011121314151617181920212223242526272829
  1. # import
  2. # ------------------------------------------------------------------------------------------
  3. # import Qt
  4. from PyQt5 import QtCore, QtWidgets
  5. # QT matplotlib
  6. from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
  7. from matplotlib.figure import Figure
  8. class FigureWidget(FigureCanvas):
  9. """
  10. description of class
  11. """
  12. def __init__(self, parent=None, width=5, height=5, dpi=100):
  13. # create Figure
  14. fig = Figure(figsize=(width, height), dpi=dpi)
  15. self.axes = fig.add_subplot(111)
  16. # explicite call of super controller
  17. FigureCanvas.__init__(self, fig)
  18. self.setParent(parent)
  19. FigureCanvas.updateGeometry(self)