Shortwave Coder
Shortwave Coder

Reputation: 11

HistogramLUTWidget with PyQtGraph

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:

Click to see histogram image

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.

Upvotes: 1

Views: 30

Answers (0)

Related Questions