[Python] HistogramLUTWidget with PyQtGraph

Discussão em 'Python' iniciado por Stack, Fevereiro 18, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to make a representation of a RTL-SDR capture. I can show a couple of graphs, spectrum and waterfall with their histogram. The problem is that the histogram auto-adjusts the levels. I would like to avoid this auto-adjustment and I've tried everything. It's possible that it's a PyQtGraph bug.

    # Waterfall
    self.waterfall = pg.PlotWidget()
    self.waterfall_image = pg.ImageItem()
    self.waterfall_image.setOpts(axisOrder='row-major')
    self.waterfall.addItem(self.waterfall_image)
    self.waterfall.setMouseEnabled(x=False, y=False)
    self.waterfall.getPlotItem().showAxes(False)
    # Histogram
    histogram = pg.HistogramLUTWidget()
    histogram.setHistogramRange(0, 255)
    histogram.setImageItem(self.waterfall_image)
    histogram.item.gradient.loadPreset('viridis')


    The versions I have are:


    • pyqtgraph==0.13.7


    • PySide6==6.8.2

    [​IMG]

    I have tried to use without success:

    self.waterfall_image.setLevels((0,255))

    and

    histogram.vb.enableAutoRange(enable=False)

    By dragging the histogram levels with the mouse, it quickly returns to how it was.

    Continue reading...

Compartilhe esta Página