diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py new file mode 100644 index 00000000..d99fe947 --- /dev/null +++ b/pylot/core/util/widgets.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Mar 19 11:27:35 2014 + +@author: sebastianw +""" + +import matplotlib + +matplotlib.use('Qt4Agg') +matplotlib.rcParams['backend.qt4'] = 'PySide' + +from matplotlib.figure import Figure +from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg + + +class MPLWidget(FigureCanvasQTAgg): + + def __init__(self, parent=None, xlabel='x', ylabel='y', title='Title'): + super(MPLWidget, self).__init__(Figure()) + + self.setParent(parent) + self.figure = Figure() + self.canvas = FigureCanvasQTAgg(self.figure) + self.axes = self.figure.add_subplot(111) + + self.axes.set_xlabel(xlabel) + self.axes.set_ylabel(ylabel) + self.axes.set_title(title)