How to use the pyqtgraph.PlotCurveItem function in pyqtgraph

To help you get started, we’ve selected a few pyqtgraph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ggajoch / SolderingStation / Software / PyGUI / main.py View on Github external
def setup_graph_curves(self):
        self.log.info("Creating graph curves")
        # actual temperature
        self.curve_actual = self.ui.widget.getPlotItem().plot()
        self.curve_actual.setPen(pen=pg.mkPen(color='#ffffff', width=2))

        # setpoint temperature
        self.curve_setpoint = pg.PlotCurveItem(pen=pg.mkPen(color='#0fff00', width=1))
        self.ui.widget.getPlotItem().addItem(self.curve_setpoint)

        # second axis - power
        p = self.ui.widget.plotItem
        p.showAxis('right')

        p2 = pg.ViewBox()
        p.scene().addItem(p2)
        p.getAxis('right').linkToView(p2)
        p2.setXLink(p)

        self.curve_power = pg.PlotCurveItem(pen=pg.mkPen(color='#ff0000', width=1))
        p2.addItem(self.curve_power)

        def updateViews():
            p2.setGeometry(p.getViewBox().sceneBoundingRect())
github biolab / orange3 / Orange / widgets / visualize / owlineplot.py View on Github external
def _get_mean_curve(self):
        pen = self.make_pen(self.color.darker(LinePlotStyle.MEAN_DARK_FACTOR),
                            LinePlotStyle.MEAN_WIDTH)
        return pg.PlotCurveItem(x=self.x_data, y=self.__mean,
                                pen=pen, antialias=True)
github BioDepot / BioDepot-workflow-builder / orange3 / Orange / widgets / visualize / owdistributions.py View on Github external
)
                inter_X = numpy.array(
                    numpy.linspace(all_X[0], all_X[-1], len(all_X) * 2)
                )
                curvesinterp = [numpy.interp(inter_X, X, Y) for (X, Y) in curvesline]
                sumprob = numpy.sum(curvesinterp, axis=0)
                legal = sumprob > 0.05 * numpy.max(sumprob)

                i = len(curvesinterp) + 1
                show_all = self.show_prob == i
                for Y, color, cval in reversed(
                    list(zip(curvesinterp, colors, cvar_values))
                ):
                    i -= 1
                    if show_all or self.show_prob == i:
                        item = pg.PlotCurveItem()
                        pen = QPen(QBrush(color), 3, style=Qt.DotLine)
                        pen.setCosmetic(True)
                        prob = Y[legal] / sumprob[legal]
                        item.setData(
                            inter_X[legal],
                            prob,
                            antialias=True,
                            stepMode=False,
                            fillLevel=None,
                            brush=None,
                            pen=pen,
                        )
                        self.plot_prob.addItem(item)
                        item.tooltip = "Probability that \n" + cvar.name + "=" + cval
                        self.tooltip_items.append((self.plot_prob, item))
github tridesclous / tridesclous / tridesclous / gui / isiviewer.py View on Github external
for k in self.controller.positive_cluster_labels:
            if not self.controller.cluster_visible[k]:
                continue
            
            if k not in self.all_isi:
                self._compute_isi(k)
            
            isi = self.all_isi[k]
            if len(isi) ==0:
                return
            
            bins = np.arange(self.params['bin_min'], self.params['bin_max'], self.params['bin_size'])
            count, bins = np.histogram(isi, bins=bins)
            
            qcolor = self.controller.qcolors[k]
            curve = pg.PlotCurveItem(bins[:-1], count, pen=pg.mkPen(qcolor, width=3))
            self.plot.addItem(curve)
github tridesclous / tridesclous / tridesclous / gui / waveformviewer.py View on Github external
#~ print('WaveformViewer.initialize_plot', self.controller.some_waveforms)
        if self.controller.get_waveform_left_right()[0] is None:
            return
            
        self.viewBox1 = MyViewBox()
        self.viewBox1.disableAutoRange()

        grid = pg.GraphicsLayout(border=(100,100,100))
        self.graphicsview.setCentralItem(grid)
        
        
        self.plot1 = grid.addPlot(row=0, col=0, rowspan=2, viewBox=self.viewBox1)
        self.plot1.hideButtons()
        self.plot1.showAxis('left', True)

        self.curve_one_waveform = pg.PlotCurveItem([], [], pen=pg.mkPen(QT.QColor( 'white'), width=1), connect='finite')
        self.plot1.addItem(self.curve_one_waveform)
        
        if self.mode=='flatten':
            grid.nextRow()
            grid.nextRow()
            self.viewBox2 = MyViewBox()
            self.viewBox2.disableAutoRange()
            self.plot2 = grid.addPlot(row=2, col=0, rowspan=1, viewBox=self.viewBox2)
            self.plot2.hideButtons()
            self.plot2.showAxis('left', True)
            self.viewBox2.setXLink(self.viewBox1)
            self.factor_y = 1.
            
            self._common_channels_flat = None

        elif self.mode=='geometry':
github tridesclous / tridesclous / tridesclous / gui / silhouette.py View on Github external
y_lower = 10
        cluster_visible = self.controller.cluster_visible
        visibles = [c for c, v in self.controller.cluster_visible.items() if v and c>=0]
        
        for k in visibles:
            if k not in silhouette_by_labels:
                continue
            v = silhouette_by_labels[k]
            
            color = self.controller.qcolors[k]
            color2 = QT.QColor(color)
            color2.setAlpha(self.alpha)
            
            y_upper = y_lower + v.size
            y_vect = np.arange(y_lower, y_upper)
            curve1 = pg.PlotCurveItem(np.zeros(v.size), y_vect, pen=color)
            curve2 = pg.PlotCurveItem(v, y_vect, pen=color)
            self.plot.addItem(curve1)
            self.plot.addItem(curve2)
            fill = pg.FillBetweenItem(curve1=curve1, curve2=curve2, brush=color2)
            self.plot.addItem(fill)
            
            txt = pg.TextItem( text='{}'.format(k), color='#FFFFFF', anchor=(0, 0.5), border=None)#, fill=pg.mkColor((128,128,128, 180)))
            self.plot.addItem(txt)
            txt.setPos(0, (y_upper+y_lower)/2.)
            
            y_lower = y_upper + 10

        
        self.plot.setXRange(-.5, 1.)
        self.plot.setYRange(0,y_lower)
github parkin / pypore / src / pypore-gui / eventanalysis.py View on Github external
events = database['Events']
            sample_rate = database['sample_rate'][0][0]
            for i in range(0, len(events)):
                event = events[i][0][0] # extra zeroes come from way scipy.io saves .mat
                baseline = event['baseline'][0][0][0]
                levels = event['cusum_values'][0][0]
                for level in levels:
                    currentBlockade.append(level - baseline)
                dwellTime = (event['event_end'][0][0][0]-event['event_start'][0][0][0])/sample_rate
                dwellTimes.append(dwellTime)
                
        color = params['color']
        newcolor = QtGui.QColor(color.red(),color.green(),color.blue(),128)
                 
        y_dt,x_dt = np.histogram(dwellTimes, bins=40)        
        curve_dt = PlotCurveItem(x_dt, y_dt, stepMode=True, fillLevel=0, brush=newcolor)
        self.plot_eventdur.addItem(curve_dt)
        
        y_cb,x_cb = np.histogram(currentBlockade, bins=40)        
        curve_cb = PlotCurveItem(x_cb, y_cb, stepMode=True, fillLevel=0, brush=newcolor)
        self.plot_eventdepth.addItem(curve_cb)
        
        return
github biolab / orange3 / Orange / widgets / utils / slidergraph.py View on Github external
def _plot_horizontal_lines(self):
        """
        Function plots the vertical dashed lines that points to the selected
        sequence values at the y axis.
        """
        for _ in range(len(self.sequences)):
            self.plot_horline.append(PlotCurveItem(
                pen=mkPen(QColor(Qt.blue), style=Qt.DashLine)))
            self.plot_horlabel.append(TextItem(
                color=QColor(Qt.black), anchor=(0, 1)))
        for item in self.plot_horlabel + self.plot_horline:
            self.addItem(item)
github tridesclous / tridesclous / tridesclous / gui / ndscatter.py View on Github external
self.limit = m
        
        ndim = self.data.shape[1]
        self.selected_comp = np.ones( (ndim), dtype='bool')
        self.projection = np.zeros( (ndim, 2))
        self.projection[0,0] = 1.
        self.projection[1,1] = 1.
        
        self.point_visible = np.zeros(self.data.shape[0], dtype=bool)
        self.by_cluster_random_decimate(refresh=False)
        
        self.plot2 = pg.PlotItem(viewBox=MyViewBox(lockAspect=True))
        self.graphicsview2.setCentralItem(self.plot2)
        self.plot2.hideButtons()
        angles = np.arange(0,360, .1)
        self.circle = pg.PlotCurveItem(x=np.cos(angles), y=np.sin(angles), pen=(255,255,255))
        self.plot2.addItem(self.circle)
        self.direction_lines = pg.PlotCurveItem(x=[], y=[], pen=(255,255,255))
        self.direction_data = np.zeros( (ndim*2, 2))
        self.plot2.addItem(self.direction_lines)
        self.plot2.setXRange(-1, 1)
        self.plot2.setYRange(-1, 1)
        self.proj_labels = []
        for i in range(ndim):
            text = 'PC{}'.format(i)
            label = pg.TextItem(text, color=(1,1,1), anchor=(0.5, 0.5), border=None, fill=pg.mkColor((128,128,128, 180)))
            self.proj_labels.append(label)
            self.plot2.addItem(label)
        
        self.graphicsview2.setMaximumSize(200, 200)
        
        #~ self.hyper_faces = list(itertools.product(range(ndim), range(ndim)))
github tridesclous / tridesclous / tridesclous / gui / silhouette.py View on Github external
cluster_visible = self.controller.cluster_visible
        visibles = [c for c, v in self.controller.cluster_visible.items() if v and c>=0]
        
        for k in visibles:
            if k not in silhouette_by_labels:
                continue
            v = silhouette_by_labels[k]
            
            color = self.controller.qcolors[k]
            color2 = QT.QColor(color)
            color2.setAlpha(self.alpha)
            
            y_upper = y_lower + v.size
            y_vect = np.arange(y_lower, y_upper)
            curve1 = pg.PlotCurveItem(np.zeros(v.size), y_vect, pen=color)
            curve2 = pg.PlotCurveItem(v, y_vect, pen=color)
            self.plot.addItem(curve1)
            self.plot.addItem(curve2)
            fill = pg.FillBetweenItem(curve1=curve1, curve2=curve2, brush=color2)
            self.plot.addItem(fill)
            
            txt = pg.TextItem( text='{}'.format(k), color='#FFFFFF', anchor=(0, 0.5), border=None)#, fill=pg.mkColor((128,128,128, 180)))
            self.plot.addItem(txt)
            txt.setPos(0, (y_upper+y_lower)/2.)
            
            y_lower = y_upper + 10

        
        self.plot.setXRange(-.5, 1.)
        self.plot.setYRange(0,y_lower)