コード例 #1
0
ファイル: mplchart.py プロジェクト: patrickyeon/spurdist
    def __init__(self, spurset, fef, parent):
        chart.__init__(self, spurset, fef, parent)

        # make the figure blend in with the native application look
        bgcol = parent.palette().window().color().toRgb()
        bgcol = [bgcol.redF(), bgcol.greenF(), bgcol.blueF()]

        self.fig = Figure()
        self.fig.set_facecolor(bgcol)
        
        # a FigureCanvas can be added as a QWidget, so we use that
        self.plot = FigureCanvas(self.fig)
        self.plot.setParent(parent)

        self.ax = self.fig.add_subplot(111)
        # TODO skip this, just do a redraw() after initialization?
        self.ax.set_xlim(self.spurset.RFmin, self.spurset.RFmax)
        self.ax.set_ylim(-0.5*self.spurset.dspan, 0.5*self.spurset.dspan)
        self.ax.grid(True)
        self.fig.tight_layout()

        # a second figure to hold the legend
        self.legendFig = Figure()
        self.legendFig.set_facecolor(bgcol)
        self.legendCanvas = FigureCanvas(self.legendFig)
        self.legendFig.legend(*self.ax.get_legend_handles_labels(),
                              loc='upper left')

        # connect up the picker watching
        self.picked_obj = None
        self._pick = self.plot.mpl_connect('pick_event', self.onpick)
        self._drag = self.plot.mpl_connect('motion_notify_event', self.ondrag)
        self._drop = self.plot.mpl_connect('button_release_event', self.ondrop)
コード例 #2
0
ファイル: mplchart.py プロジェクト: yrrapt/spurdist
    def __init__(self, spurset, fef, parent):
        chart.__init__(self, spurset, fef, parent)

        # make the figure blend in with the native application look
        bgcol = parent.palette().window().color().toRgb()
        bgcol = [bgcol.redF(), bgcol.greenF(), bgcol.blueF()]

        self.fig = Figure()
        self.fig.set_facecolor(bgcol)

        # a FigureCanvas can be added as a QWidget, so we use that
        self.plot = FigureCanvas(self.fig)
        self.plot.setParent(parent)

        self.ax = self.fig.add_subplot(111)
        # TODO skip this, just do a redraw() after initialization?
        self.ax.set_xlim(self.spurset.RFmin, self.spurset.RFmax)
        self.ax.set_ylim(-0.5 * self.spurset.dspan, 0.5 * self.spurset.dspan)
        self.ax.grid(True)
        self.fig.tight_layout()

        # a second figure to hold the legend
        self.legendFig = Figure()
        self.legendFig.set_facecolor(bgcol)
        self.legendCanvas = FigureCanvas(self.legendFig)
        self.legendFig.legend(*self.ax.get_legend_handles_labels(),
                              loc='upper left')

        # connect up the picker watching
        self.picked_obj = None
        self._pick = self.plot.mpl_connect('pick_event', self.onpick)
        self._drag = self.plot.mpl_connect('motion_notify_event', self.ondrag)
        self._drop = self.plot.mpl_connect('button_release_event', self.ondrop)
コード例 #3
0
ファイル: qwtchart.py プロジェクト: patrickyeon/spurdist
    def __init__(self, spurset, fef, parent):
        chart.__init__(self, spurset, fef, parent)
        self.plot = QwtPlot(parent)

        self.plot.setAxisScale(xaxis, self.spurset.RFmin,
                               self.spurset.RFmax)
        self.plot.setAxisScale(yaxis, -self.spurset.dspan/2,
                               self.spurset.dspan/2)

        self.plot.setCanvasBackground(Qt.white)
        grid = QwtPlotGrid()
        grid.setMajPen(QPen(Qt.black, 1, Qt.DotLine))
        grid.attach(self.plot)

        self.plot.insertLegend(QwtLegend(self.parent), QwtPlot.ExternalLegend)

        # a picker to be used for the front-end filter parallelogram
        self.picker = QwtPlotPicker(xaxis, yaxis,
                                    QwtPicker.PointSelection,
                                    QwtPlotPicker.NoRubberBand,
                                    QwtPicker.AlwaysOff,
                                    self.plot.canvas())
        # gonna need this to implement ondrop()
        self._mouseRelease = self.picker.widgetMouseReleaseEvent
        self._picked_obj = None

        self.picker.connect(self.picker, SIGNAL('appended(const QPoint&)'),
                            self.onpick)
        self.picker.connect(self.picker, SIGNAL('moved(const QPoint&)'),
                            self.ondrag)
        # all about the monkey-patching
        self.picker.widgetMouseReleaseEvent = self.ondrop
コード例 #4
0
ファイル: qwtchart.py プロジェクト: yrrapt/spurdist
    def __init__(self, spurset, fef, parent):
        chart.__init__(self, spurset, fef, parent)
        self.plot = QwtPlot(parent)

        self.plot.setAxisScale(xaxis, self.spurset.RFmin, self.spurset.RFmax)
        self.plot.setAxisScale(yaxis, -self.spurset.dspan / 2,
                               self.spurset.dspan / 2)

        self.plot.setCanvasBackground(Qt.white)
        grid = QwtPlotGrid()
        grid.setMajPen(QPen(Qt.black, 1, Qt.DotLine))
        grid.attach(self.plot)

        self.plot.insertLegend(QwtLegend(self.parent), QwtPlot.ExternalLegend)

        # a picker to be used for the front-end filter parallelogram
        self.picker = QwtPlotPicker(xaxis, yaxis, QwtPicker.PointSelection,
                                    QwtPlotPicker.NoRubberBand,
                                    QwtPicker.AlwaysOff, self.plot.canvas())
        # gonna need this to implement ondrop()
        self._mouseRelease = self.picker.widgetMouseReleaseEvent
        self._picked_obj = None

        self.picker.connect(self.picker, SIGNAL('appended(const QPoint&)'),
                            self.onpick)
        self.picker.connect(self.picker, SIGNAL('moved(const QPoint&)'),
                            self.ondrag)
        # all about the monkey-patching
        self.picker.widgetMouseReleaseEvent = self.ondrop
コード例 #5
0
 def __init__(self, spurset, fef, parent):
     chart.__init__(self, spurset, fef, parent)
     pg.setConfigOption('background', 'w')
     pg.setConfigOption('foreground', 'k')
     self.plot = pg.PlotWidget(parent)
コード例 #6
0
 def __init__(self, spurset, fef, parent):
     chart.__init__(self, spurset, fef, parent)
     pg.setConfigOption('background', 'w')
     pg.setConfigOption('foreground', 'k')
     self.plot = pg.PlotWidget(parent)