How to use the pyqtgraph.setConfigOption 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 timvandermeij / radio-tomography / tools / plotter.py View on Github external
PACKETS_UNTIL_UPDATE = 4
UPDATE_COUNTER = 0
X = []
YRSS = []
YCORR = []

# Get the channel to monitor from the provided arguments
if len(sys.argv) == 1:
    print("Provide a channel as argument.")
    os._exit(1)

channel = int(sys.argv[1])

# Create the plot window
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
plt = pg.plot()
plt.plotItem.setYRange(-40, 120)

# Update the plot with the new data
def update():
    x, yRss, yCorr = parse(collect())
    plt.plotItem.setXRange(UPDATE_COUNTER * PACKETS_UNTIL_UPDATE - 100, UPDATE_COUNTER * PACKETS_UNTIL_UPDATE)
    plt.plot(x, yRss, pen=pg.mkPen('r', width=2), antialias=True, name='RSS', clear=True)
    plt.plot(x, yCorr, pen=pg.mkPen('b', width=2), antialias=True, name='Correlation value')
    
# Collect measurements from the serial port (USB dongle)
def collect():
    # Open the serial connection
    ser = serial.Serial("/dev/ttyACM0", 38400);
    beef = '\xef' + '\xbe'
github gnuradio / gnuradio / gr-filter / python / filter / gui / idealbanditems.py View on Github external
def __init__(self):
        # Set Global pyqtgraph options
        pg.setConfigOption('foreground', 'k')   # Default foreground color for text, lines, axes, etc.
        pg.setConfigOption('background', None)  # Default background for GraphicsView.
        pg.setConfigOptions(antialias=True)     # Draw lines with smooth edges at the cost of reduced performance.

        self.win = pg.GraphicsWindow()
        self.plot = self.win.addPlot()
        self.idealbandhcurves = [self.plot.plot() for i in range(4)]
        self.idealbandvcurves = [self.plot.plot() for i in range(4)]
        self.params = ""
github openmodal / OpenModal / OpenModal / gui / widgets / animation.py View on Github external
else:
    from OpenModal.gui.widgets.languages import LANG_DICT

from functools import partial

import datetime as tm

# Warning controls
# import warnings
#warnings.filterwarnings('error')
#warnings.simplefilter('error', FutureWarning)
#np.seterr(all='raise')

# ## Switch to using white background and black foreground
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')

WIDGET_MODES = ['raw_data', 'EMA', 'ODS']

SHADER='OpenModal'

GLOPTS= {
        GL_DEPTH_TEST: True,
        GL_BLEND: False,
        GL_ALPHA_TEST: False,
        GL_CULL_FACE: False}
        #'glLightModeli':(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE)}
SMOOTH=False # If TRUE then normals are recomputed when new triangles are added
COMPUTENORMALS=True
DRAW_EDGES_NODES=False
DRAW_EDGES_ELEMENTS=True
DRAW_EDGES_GCS=False
github pysmo / aimbat / pysmo / aimbat / ttguiqt.py View on Github external
def main():
    gsac, opts = getDataOpts()
    pg.setConfigOption('background', 'w')
    pg.setConfigOption('foreground', 'k')
    gui = mainGUI(gsac, opts)
    ### Start Qt event loop unless running in interactive mode or using pyside.
    if sys.flags.interactive != 1 or not hasattr(QtCore, 'PYQT_VERSION'):
        #pg.QtGui.QApplication.exec_()
        gui.app.exec_()


if __name__ == '__main__':
#    main()
    gsac, opts = getDataOpts()
    pg.setConfigOption('background', 'w')
    pg.setConfigOption('foreground', 'k')
    gui = mainGUI(gsac, opts)
    ### Start Qt event loop unless running in interactive mode or using pyside.
    if sys.flags.interactive != 1 or not hasattr(QtCore, 'PYQT_VERSION'):
        #pg.QtGui.QApplication.exec_()
        gui.app.exec_()
github constverum / Quantdom / quantdom / lib / charts.py View on Github external
"""Chart."""

import numpy as np
import pyqtgraph as pg
from PyQt5 import QtCore, QtGui

from .base import Quotes
from .const import ChartType
from .portfolio import Order, Portfolio
from .utils import fromtimestamp, timeit

__all__ = ('QuotesChart', 'EquityChart')


pg.setConfigOption('background', 'w')
CHART_MARGINS = (0, 0, 20, 5)


class SampleLegendItem(pg.graphicsItems.LegendItem.ItemSample):
    def paint(self, p, *args):
        p.setRenderHint(p.Antialiasing)
        if isinstance(self.item, tuple):
            positive = self.item[0].opts
            negative = self.item[1].opts
            p.setPen(pg.mkPen(positive['pen']))
            p.setBrush(pg.mkBrush(positive['brush']))
            p.drawPolygon(
                QtGui.QPolygonF(
                    [
                        QtCore.QPointF(0, 0),
                        QtCore.QPointF(18, 0),
github acconeer / acconeer-python-exploration / src / acconeer / exptool / pg_process.py View on Github external
def pg_process_program(q, exit_event, updater, max_freq):
    signal.signal(signal.SIGINT, signal.SIG_IGN)

    app = QtWidgets.QApplication([])
    pg.setConfigOption("background", "w")
    pg.setConfigOption("foreground", "k")
    pg.setConfigOptions(antialias=True)
    win = pg.GraphicsLayoutWidget()
    win.closeEvent = lambda _: exit_event.set()

    updater.setup(win)

    win.show()
    app.processEvents()

    while not exit_event.is_set():
        data = None
        try:
            data = q.get(timeout=0.1)
            while True:
                data = q.get(timeout=0.001)
github typograph / pysimiam / scripts / qt_plotwindow_qtgraph.py View on Github external
import pyqtgraph as pg
from random import randint

pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')

def get_color(color):
    if color is None:
        color = 'random'
    if isinstance(color,str):
        if color == 'random':
            return (randint(0,0xFF),randint(0,0xFF),randint(0,0xFF))
        elif color == 'black':
            return 0
        elif color == 'blue':
            return 'b'
        elif color == 'red':
            return 'r'
        elif color == 'green':
            return 'g'
    elif isinstance(color,tuple) or isinstance(color,list):
github gnuradio / gnuradio / gr-filter / python / filter / gui / idealbanditems.py View on Github external
def __init__(self):
        # Set Global pyqtgraph options
        pg.setConfigOption('foreground', 'k')   # Default foreground color for text, lines, axes, etc.
        pg.setConfigOption('background', None)  # Default background for GraphicsView.
        pg.setConfigOptions(antialias=True)     # Draw lines with smooth edges at the cost of reduced performance.

        self.win = pg.GraphicsWindow()
        self.plot = self.win.addPlot()
        self.idealbandhcurves = [self.plot.plot() for i in range(4)]
        self.idealbandvcurves = [self.plot.plot() for i in range(4)]
        self.params = ""
github jddes / Frequency-comb-DPLL / digital_servo_python_gui / SpectrumWidget.py View on Github external
self.qcombo_adc_plottype = Qt.QComboBox()
        self.qcombo_adc_plottype.addItems(['Spectrum', 'Time: raw input', 'Time: Phase', 'Time: IQ', 'Time: IQ, synced'])

        

        # Input select        
        self.qlabel_adc_plot_input = Qt.QLabel('Input:')
        self.qcombo_adc_plot = Qt.QComboBox()
        self.qcombo_adc_plot.addItems(['ADC0', 'ADC1', 'DAC0', 'DAC1', 'DAC2'])
        self.qcombo_adc_plot.setCurrentIndex(self.selected_ADC)
        
        # Set a few global PyQtGraph settings before creating plots:
        pg.setConfigOption('leftButtonPan', False)
        pg.setConfigOption('background', 'w')
        pg.setConfigOption('foreground', 'k')
        pg.setConfigOption('antialias', True)


        # Create the baseband IQ plot:
        #self.qplt_IQ = Qwt.QwtPlot()
        self.qplt_IQ = pg.PlotWidget()
        #self.qplt_IQ.move(50, 50)
        #self.qplt_IQ.resize(200, 200)
        self.qplt_IQ.setMinimumSize(50, 50)
        self.qplt_IQ.setMaximumSize(200, 200)
        self.qplt_IQ.setFixedSize(100, 100)
#        self.qplt_IQ.setsetHeightForWidth(True)
        # qPolicy = Qt.QSizePolicy(Qt.QSizePolicy.Preferred, Qt.QSizePolicy.Preferred)
        qPolicy = Qt.QSizePolicy(Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Fixed)
        # qPolicy.setHeightForWidth(True)
        self.qplt_IQ.setSizePolicy(qPolicy)
github acconeer / acconeer-python-exploration / gui / main.py View on Github external
def init_pyqtgraph(self):
        pg.setConfigOption("background", "#f0f0f0")
        pg.setConfigOption("foreground", "k")
        pg.setConfigOption("leftButtonPan", False)
        pg.setConfigOptions(antialias=True)