當前位置: 首頁>>代碼示例>>Python>>正文


Python pyqtgraph.hsvColor方法代碼示例

本文整理匯總了Python中pyqtgraph.hsvColor方法的典型用法代碼示例。如果您正苦於以下問題:Python pyqtgraph.hsvColor方法的具體用法?Python pyqtgraph.hsvColor怎麽用?Python pyqtgraph.hsvColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyqtgraph的用法示例。


在下文中一共展示了pyqtgraph.hsvColor方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setup_range

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import hsvColor [as 別名]
def setup_range(self):
        self.win = np.hanning(self.bins)
        
        FS = self.sampling_rate

        #num_bars = int(round((self.bins - 1) * (self.hi - self.lo) / FS))
        num_bars = len(np.zeros(self.bins)[self.lo: self.hi])

        #print 'num_bars', num_bars, self.bins * (self.hi - self.lo) / FS

        x = np.linspace(self.lo, self.hi, num_bars)

        self.bars = pg.BarGraphItem(x=x, height=range(num_bars), width=1.0)
        
        self.bars.setOpts(brushes=[pg.hsvColor(float(x) / num_bars) for x in range(num_bars)])
        self.plot.addItem(self.bars) 
開發者ID:strfry,項目名稱:OpenNFB,代碼行數:18,代碼來源:display.py

示例2: update

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import hsvColor [as 別名]
def update(self):
        t1=time.clock()
        points=100 #number of data points
        X=np.arange(points)
        Y=np.sin(np.arange(points)/points*3*np.pi+time.time())
        C=pyqtgraph.hsvColor(time.time()/5%1,alpha=.5)
        pen=pyqtgraph.mkPen(color=C,width=10)
        self.grPlot.plot(X,Y,pen=pen,clear=True)
        print("update took %.02f ms"%((time.clock()-t1)*1000))
        if self.chkMore.isChecked():
            QtCore.QTimer.singleShot(1, self.update) # QUICKLY repeat 
開發者ID:swharden,項目名稱:Python-GUI-examples,代碼行數:13,代碼來源:go.py

示例3: wlPen

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import hsvColor [as 別名]
def wlPen(wl):
    """Return a pen representing the given wavelength"""
    l1 = 400
    l2 = 700
    hue = np.clip(((l2-l1) - (wl-l1)) * 0.8 / (l2-l1), 0, 0.8)
    val = 1.0
    if wl > 700:
        val = 1.0 * (((700-wl)/700.) + 1)
    elif wl < 400:
        val = wl * 1.0/400.
    #print hue, val
    color = pg.hsvColor(hue, 1.0, val)
    pen = pg.mkPen(color)
    return pen 
開發者ID:SrikanthVelpuri,項目名稱:tf-pose,代碼行數:16,代碼來源:pyoptic.py

示例4: draw_buffer

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import hsvColor [as 別名]
def draw_buffer(self):
        self.buff_win = pg.GraphicsLayoutWidget()
        self.buff_win.setWindowTitle('Buffer Status')
        self.buff_win.resize(800, 700)

        self.total_peers = self.number_of_monitors + self.number_of_peers + self.number_of_malicious
        self.p4 = self.buff_win.addPlot()
        self.p4.showGrid(x=True, y=True, alpha=100)   # To show grid lines across x axis and y axis
        leftaxis = self.p4.getAxis('left')  # get left axis i.e y axis
        leftaxis.setTickSpacing(5, 1)    # to set ticks at a interval of 5 and grid lines at 1 space

        # Get different colors using matplotlib library
        if self.total_peers < 8:
            colors = cm.Set2(np.linspace(0, 1, 8))
        elif self.total_peers < 12:
            colors = cm.Set3(np.linspace(0, 1, 12))
        else:
            colors = cm.rainbow(np.linspace(0, 1, self.total_peers+1))
        self.QColors = [pg.hsvColor(color[0], color[1], color[2], color[3])
                        for color in colors]   # Create QtColors, each color would represent a peer

        self.Data = []  # To represent buffer out  i.e outgoing data from buffer
        self.OutData = []   # To represent buffer in i.e incoming data in buffer

        # a single line would reperesent a single color or peer, hence we would not need to pass a list of brushes
        self.lineIN = [None]*self.total_peers
        for ix in range(self.total_peers):
            self.lineIN[ix] = self.p4.plot(pen=(None), symbolBrush=self.QColors[ix], name='IN', symbol='o', clear=False)
            self.Data.append(set())
            self.OutData.append(set())

        # similiarly one line per peer to represent outgoinf data from buffer
        self.lineOUT = self.p4.plot(pen=(None), symbolBrush=mkColor('#CCCCCC'), name='OUT', symbol='o', clear=False)
        self.p4.setRange(xRange=[0, self.total_peers], yRange=[0, self.get_buffer_size()])
        self.buff_win.show()    # To actually show create window

        self.buffer_order = {}
        self.buffer_index = 0
        self.buffer_labels = []
        self.lastUpdate = pg.ptime.time()
        self.avgFps = 0.0 
開發者ID:P2PSP,項目名稱:simulator,代碼行數:43,代碼來源:play.py

示例5: init

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import hsvColor [as 別名]
def init(self, lo=0, hi=125, bins=256, yrange=750, ratio=False):
        self.widget = pg.PlotWidget()
        self.widget.setLabel('bottom', 'Frequency', units='Hz')

        self.bars = pg.BarGraphItem()

        self.win = np.hanning(bins)
        self.win = np.blackman(bins)
        #self.win = np.ones(bins)
        self.lo, self.hi = lo, hi
        self.ratio = ratio
        
        FS = self.input.sample_rate

        self.gr_block.set_history(bins)

        #num_bars = int(round((self.bins - 1) * (self.hi - self.lo) / FS))
        # This is total bullshit:
        num_bars = len(np.zeros(bins)[lo: hi])

        x = np.linspace(self.lo, self.hi, num_bars)

        self.bars = pg.BarGraphItem(x=x, height=range(num_bars), width=1.0)
        
        self.bars.setOpts(brushes=[pg.hsvColor(float(x) / num_bars) for x in range(num_bars)])
        self.widget.addItem(self.bars)

        # TODO: Better autoranging features
        #self.plot.enableAutoRange('xy', False)
        
        self.widget.setYRange(0, yrange)
        self.widget.enableAutoRange('y', 0.95)

        self.buffer = np.zeros(bins)

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.updateGUI)
        self.timer.start(10) 
開發者ID:strfry,項目名稱:OpenNFB,代碼行數:40,代碼來源:gnuradio_protocol.py

示例6: init

# 需要導入模塊: import pyqtgraph [as 別名]
# 或者: from pyqtgraph import hsvColor [as 別名]
def init(self, lo=0, hi=125, bins=256, yrange=750, ratio=False):
        self.widget = pg.PlotWidget()
        self.widget.setLabel('bottom', 'Frequency', units='Hz')

        self.bars = pg.BarGraphItem()

        self.win = np.hanning(bins)
        self.win = np.blackman(bins)
        #self.win = np.ones(bins)
        self.lo, self.hi = lo, hi
        self.ratio = ratio
        
        FS = self.input.sample_rate

        self.gr_block.set_history(bins)

        #num_bars = int(round((self.bins - 1) * (self.hi - self.lo) / FS))
        # This is total bullshit:
        num_bars = len(np.zeros(bins)[lo: hi])

        x = np.linspace(self.lo, self.hi, num_bars)

        self.bars = pg.BarGraphItem(x=x, height=range(num_bars), width=1.0)
        
        self.bars.setOpts(brushes=[pg.hsvColor(float(x) / num_bars) for x in range(num_bars)])
        self.widget.addItem(self.bars)

        # TODO: Better autoranging features
        #self.plot.enableAutoRange('xy', False)
        
        self.widget.setYRange(0, yrange)
        self.widget.enableAutoRange('y', 0.95)

        self.buffer = np.zeros(bins)

        self.timer = pg.QtCore.QTimer()
        self.timer.timeout.connect(self.updateGUI)
        self.timer.start(10) 
開發者ID:strfry,項目名稱:OpenNFB,代碼行數:40,代碼來源:display.py


注:本文中的pyqtgraph.hsvColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。