当前位置: 首页>>代码示例>>Python>>正文


Python pyqtgraph.mkColor方法代码示例

本文整理汇总了Python中pyqtgraph.mkColor方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.mkColor方法的具体用法?Python pyqtgraph.mkColor怎么用?Python pyqtgraph.mkColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtgraph的用法示例。


在下文中一共展示了pyqtgraph.mkColor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def __init__(self, parent_plot):
        KiteSubplot.__init__(self, parent_plot)

        self.structure = pg.PlotDataItem(
            antialias=True,
            pen=pen_covariance_active)
        self.variance = self.VarianceLine(
            pen=pen_variance,
            angle=0, movable=True, hoverPen=pen_variance_highlight,
            label='Variance: {value:.5f}',
            labelOpts={'position': .975,
                       'anchors': ((1., 0.), (1., 1.)),
                       'color': pg.mkColor(255, 255, 255, 155)})
        self.plot.setLabels(
            bottom=('Distance', 'm'),
            left='Variance (m<sup>2</sup>)')

        self.addItem(self.structure)
        self.addItem(self.variance)
        self.variance.sigPositionChangeFinished.connect(
            self.changeVariance) 
开发者ID:pyrocko,项目名称:kite,代码行数:23,代码来源:tab_covariance.py

示例2: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def __init__(self, layout):
        if not isinstance(layout, pg.GraphicsLayoutWidget):
            raise ValueError("layout must be instance of pyqtgraph.GraphicsLayoutWidget")

        self.layout = layout

        self.main_curve = True
        self.main_color = pg.mkColor("y")
        self.persistence = False
        self.persistence_length = 5
        self.persistence_decay = "exponential"
        self.persistence_color = pg.mkColor("g")
        self.persistence_data = None
        self.persistence_curves = None
        self.peak_hold_max = False
        self.peak_hold_max_color = pg.mkColor("r")
        self.peak_hold_min = False
        self.peak_hold_min_color = pg.mkColor("b")
        self.average = False
        self.average_color = pg.mkColor("c")
        self.baseline = False
        self.baseline_color = pg.mkColor("m")

        self.create_plot() 
开发者ID:xmikos,项目名称:qspectrumanalyzer,代码行数:26,代码来源:plot.py

示例3: draw_buffer

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [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

示例4: plot_clr

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def plot_clr(self):
        self.clrs_per_round = []
        self.clr_win = pg.GraphicsLayoutWidget()
        self.clr_win.setWindowTitle('Chunk Loss Ratio')
        self.clr_win.resize(800, 700)
        self.clr_figure = self.clr_win.addPlot()
        self.clr_figure.addLegend()
        self.lineCLR = self.clr_figure.plot(pen=(None), symbolBrush=mkColor(
            '#000000'), name="CLR", symbol='o', clear=True)
        self.clr_figure.setRange(xRange=[0, self.number_of_rounds], yRange=[0, 1])
        self.clrData = [[], []]  # 2D list to store both the x and y coordinates
        self.clr_win.show() 
开发者ID:P2PSP,项目名称:simulator,代码行数:14,代码来源:play.py

示例5: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def __init__(self, parent=None, digits=0, color=None, opacity=1, **kwargs):
        super().__init__(parent)
        self.parent = parent
        self.opacity = opacity
        self.label_str = ''
        self.digits = digits
        self.quotes_count = len(Quotes) - 1
        if isinstance(color, QtGui.QPen):
            self.bg_color = color.color()
            self.fg_color = pg.mkColor('#ffffff')
        elif isinstance(color, list):
            self.bg_color = {'>0': color[0].color(), '<0': color[1].color()}
            self.fg_color = pg.mkColor('#ffffff')
        self.setFlag(self.ItemIgnoresTransformations) 
开发者ID:constverum,项目名称:Quantdom,代码行数:16,代码来源:charts.py

示例6: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def __init__(self, view_box, x, y, text, tooltip):
        bg_color = QColor(Qt.white)
        bg_color.setAlpha(200)
        color = QColor(Qt.black)
        super().__init__(text, pg.mkColor(color), fill=pg.mkBrush(bg_color))
        self._x = x
        self._y = y
        self._view_box = view_box
        self._view_box.sigStateChanged.connect(self.center)
        self.textItem.setToolTip(tooltip)
        self.setPos(x, y)
        self.center() 
开发者ID:biolab,项目名称:orange3-bioinformatics,代码行数:14,代码来源:OWAnnotateProjection.py

示例7: update_reference_coordinates

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def update_reference_coordinates(self):
        points = self.master.get_coordinates_reference_data()
        if points is None:
            return
        if self.ref_scatterplot_item is None:
            color = pg.mkColor(200, 200, 200)
            pen, brush = pg.mkPen(color=color), pg.mkBrush(color=color)
            size = OWScatterPlotBase.MinShapeSize + 3
            self.ref_scatterplot_item = pg.ScatterPlotItem(x=points[0], y=points[1], pen=pen, brush=brush, size=size)
            self.plot_widget.addItem(self.ref_scatterplot_item)
        else:
            self.ref_scatterplot_item.setData(x=points[0], y=points[1]) 
开发者ID:biolab,项目名称:orange3-bioinformatics,代码行数:14,代码来源:OWAnnotateProjection.py

示例8: brighten

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def brighten(color, f):
    if not color:
        return color
    return pg.mkColor(color).lighter(f*100) 
开发者ID:highfestiva,项目名称:finplot,代码行数:6,代码来源:__init__.py

示例9: test_types

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def test_types():
    paramSpec = [
        dict(name='float', type='float'),
        dict(name='int', type='int'),
        dict(name='str', type='str'),
        dict(name='list', type='list', values=['x','y','z']),
        dict(name='dict', type='list', values={'x':1, 'y':3, 'z':7}),
        dict(name='bool', type='bool'),
        dict(name='color', type='color'),
    ]
    
    param = pt.Parameter.create(name='params', type='group', children=paramSpec)
    tree = pt.ParameterTree()
    tree.setParameters(param)

    all_objs = {
        'int0': 0, 'int':7, 'float': -0.35, 'bigfloat': 1e129, 'npfloat': np.float(5), 
        'npint': np.int(5),'npinf': np.inf, 'npnan': np.nan, 'bool': True, 
        'complex': 5+3j, 'str': 'xxx', 'unicode': asUnicode('µ'), 
        'list': [1,2,3], 'dict': {'1': 2}, 'color': pg.mkColor('k'), 
        'brush': pg.mkBrush('k'), 'pen': pg.mkPen('k'), 'none': None
    }
    if hasattr(QtCore, 'QString'):
        all_objs['qstring'] = QtCore.QString('xxxµ')

    # float
    types = ['int0', 'int', 'float', 'bigfloat', 'npfloat', 'npint', 'npinf', 'npnan', 'bool']
    check_param_types(param.child('float'), float, float, 0.0, all_objs, types)

    # int
    types = ['int0', 'int', 'float', 'bigfloat', 'npfloat', 'npint', 'bool']
    inttyps = int if sys.version[0] >= '3' else (int, long) 
    check_param_types(param.child('int'), inttyps, int, 0, all_objs, types)
    
    # str  (should be able to make a string out of any type)
    types = all_objs.keys()
    strtyp = str if sys.version[0] >= '3' else unicode
    check_param_types(param.child('str'), strtyp, asUnicode, '', all_objs, types)
    
    # bool  (should be able to make a boolean out of any type?)
    types = all_objs.keys()
    check_param_types(param.child('bool'), bool, bool, False, all_objs, types)

    # color
    types = ['color', 'int0', 'int', 'float', 'npfloat', 'npint', 'list']
    init = QtGui.QColor(128, 128, 128, 255)
    check_param_types(param.child('color'), QtGui.QColor, pg.mkColor, init, all_objs, types) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:49,代码来源:test_parametertypes.py

示例10: initialize_plot

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def initialize_plot(self):
        self.viewBox = MyViewBox()
        self.plot = pg.PlotItem(viewBox=self.viewBox)
        self.graphicsview.setCentralItem(self.plot)
        self.plot.hideButtons()
        self.plot.showAxis('left', False)
        
        self.viewBox.gain_zoom.connect(self.gain_zoom)
        self.viewBox.xsize_zoom.connect(self.xsize_zoom)
        
        self.visible_channels = np.zeros(self.controller.nb_channel, dtype='bool')
        self.max_channel = min(16, self.controller.nb_channel)
        #~ self.max_channel = min(5, self.controller.nb_channel)
        if self.controller.nb_channel>self.max_channel:
            self.visible_channels[:self.max_channel] = True
            self.scroll_chan.show()
            self.scroll_chan.setMinimum(0)
            self.scroll_chan.setMaximum(self.controller.nb_channel-self.max_channel)
            self.scroll_chan.setPageStep(self.max_channel)
        else:
            self.visible_channels[:] = True
            self.scroll_chan.hide()
            
        self.signals_curve = pg.PlotCurveItem(pen='#7FFF00', connect='finite')
        self.plot.addItem(self.signals_curve)

        self.scatter = pg.ScatterPlotItem(size=10, pxMode = True)
        self.plot.addItem(self.scatter)
        self.scatter.sigClicked.connect(self.scatter_item_clicked)
        
        self.channel_labels = []
        self.threshold_lines =[]
        for i, chan_name in enumerate(self.controller.channel_names):
            #TODO label channels
            label = pg.TextItem('{}: {}'.format(i, chan_name), color='#FFFFFF', anchor=(0, 0.5), border=None, fill=pg.mkColor((128,128,128, 180)))
            self.plot.addItem(label)
            self.channel_labels.append(label)
        
        
        for i in range(self.max_channel):
            tc = pg.InfiniteLine(angle = 0., movable = False, pen = pg.mkPen(color=(128,128,128, 120)))
            tc.setPos(0.)
            self.threshold_lines.append(tc)
            self.plot.addItem(tc)
            tc.hide()
        
        pen = pg.mkPen(color=(128,0,128, 120), width=3, style=QT.Qt.DashLine)
        self.selection_line = pg.InfiniteLine(pos = 0., angle=90, movable=False, pen = pen)
        self.plot.addItem(self.selection_line)
        self.selection_line.hide()
        
        self._initialize_plot()
        
        self.gains = None
        self.offsets = None 
开发者ID:tridesclous,项目名称:tridesclous,代码行数:57,代码来源:traceviewer.py

示例11: refresh

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import mkColor [as 别名]
def refresh(self):
        self.plot.clear()
        silhouette_values = self.controller.spike_silhouette
        if silhouette_values is None:
            return
        
        if silhouette_values.shape != self.controller.spike_label.shape:
            return
        
        silhouette_avg = np.mean(silhouette_values)
        silhouette_by_labels = {}
        labels = self.controller.spike_label
        labels_list = np.unique(labels)
        for k in labels_list:
            v = silhouette_values[k==labels]
            v.sort()
            silhouette_by_labels[k] = v
        
        
        self.vline = pg.InfiniteLine(pos=silhouette_avg, angle = 90, movable = False, pen = '#FF0000')
        self.plot.addItem(self.vline)
        
        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) 
开发者ID:tridesclous,项目名称:tridesclous,代码行数:55,代码来源:silhouette.py


注:本文中的pyqtgraph.mkColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。