I want to use a particular colormap (LUT) to display a 2D array using pg.ImageItem and add a pg.HistogramLUTItem near it for interactive analysis. If I initialize the image passing it my LUT and then plot it in a window, everything is okay. However, when I create the pg.HistogramLUTItem and initialize it with my image, the colormap of the image instantly changes to that of the histogram. How should I set the proper colormap in the histogram?
Here is my minimal example:
import numpy as np
import pyqtgraph as pg
myLUT = np.array([[1. , 1. , 1. ],
[0.38401946, 0.48864573, 0.963664 ],
[0.28766167, 0.81375253, 0.49518645],
[0.71970558, 0.92549998, 0.34362429]]) * 255
win = pg.GraphicsLayoutWidget()
win.show()
p1 = win.addPlot()
img = pg.ImageItem(np.random.rand(100, 100), lut=myLUT)
p1.addItem(img)
hist = pg.HistogramLUTItem()
hist.setImageItem(img)
... and here the image already changes to the "default" lut of the histogram.
I would expect the histogram to "inherit" the LUT of the image and automatically adopt the LookUpTable in the colorbar, but it is actually the other way around.
How can correct this behavior? Do I have to initialize the histogram with myLUT? I cannot see how to do that.