Hi,
I think the colormaps are always interpolated. If you run the pyqtgraph Color Maps example you'll see even the discrete maps imported from matplotlib get interpolated.
It might be possible to define your own colormap with two stops at the same location. It might break, but it might also work...
I've hard coded in my own colormaps before using something like:
#...
self.cbar = pg.HistogramLUTItem(self.overview_composite_image)
self.cbar.gradient.restoreState({"mode": "rgb",
"ticks": [(0.00, (0, 0, 0)),
(0.25, (0, 0, 128)),
(0.50, (144, 0 , 0)),
(0.85, (224, 224, 0)),
(1.00, (255, 255, 255))]})
#...
So you could try putting two stops for each colour something like:
self.cbar.gradient.restoreState({"mode": "rgb",
"ticks": [(0.00, (0, 0, 0)),
(0.25, (0, 0, 0)),
(0.25, (0, 0, 128)),
(0.50, (0, 0, 128)),
(0.50, (144, 0 , 0)),
(0.85, (144, 0, 0)),
(0.85, (255, 255, 255)),
(1.00, (255, 255, 255))]})
#...
It's possible you may need to make the next range start at 0.25000001 etc if things break because of divide-by-zero errors.
The "proper" way to do it would be to write a ColorMap subclass DiscreteColorMap or similar that handles the functionality.
Patrick