From 6e22524ac28f484ff74d12853b0a5bf6ba6b0fb2 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Tue, 26 Sep 2017 08:50:31 -0700 Subject: [PATCH] Update histogramlut example to allow rgb mode --- examples/HistogramLUT.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/examples/HistogramLUT.py b/examples/HistogramLUT.py index 4d89dd3f..082a963c 100644 --- a/examples/HistogramLUT.py +++ b/examples/HistogramLUT.py @@ -28,19 +28,27 @@ v = pg.GraphicsView() vb = pg.ViewBox() vb.setAspectLocked() v.setCentralItem(vb) -l.addWidget(v, 0, 0) +l.addWidget(v, 0, 0, 3, 1) w = pg.HistogramLUTWidget() l.addWidget(w, 0, 1) -data = pg.gaussianFilter(np.random.normal(size=(256, 256)), (20, 20)) +monoRadio = QtGui.QRadioButton('mono') +rgbaRadio = QtGui.QRadioButton('rgba') +l.addWidget(monoRadio, 1, 1) +l.addWidget(rgbaRadio, 2, 1) +monoRadio.setChecked(True) + +def setLevelMode(): + mode = 'mono' if monoRadio.isChecked() else 'rgba' + w.setLevelMode(mode) +monoRadio.toggled.connect(setLevelMode) + +data = pg.gaussianFilter(np.random.normal(size=(256, 256, 3)), (20, 20, 0)) for i in range(32): for j in range(32): data[i*8, j*8] += .1 img = pg.ImageItem(data) -#data2 = np.zeros((2,) + data.shape + (2,)) -#data2[0,:,:,0] = data ## make non-contiguous array for testing purposes -#img = pg.ImageItem(data2[0,:,:,0]) vb.addItem(img) vb.autoRange()