Hello,
I am trying to have a repeating colormap applied to an image view. so if i
have a map with 256 colors, for values 0-255, that means color 10 will be
the same as 266
in the file provided here is what I tried.
I would like the first two bars of my image to have same color.
Any help would be appreciated!
ideally i am trying to get this to work in pyqtgraph0.11 but I switched to
0.12.2 in this example , because i just want to understand it, but i am
stuck :(
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/2ada18fc-da01-4fcd-b7fe-9ff365476ea8n%40googlegroups.com.
import sys
from pyqtgraph.imageview.ImageView import *
from pyqtgraph.colormap import ColorMap
import pyqtgraph as pg
if __name__ == '__main__':
app = QtGui.QApplication()
pg.setConfigOptions(imageAxisOrder='row-major') # todo check if this is still needed
imv = ImageView()
data = np.hstack(
(np.full((100, 10), 10), np.full((100, 10), 266), np.full((100, 10), 300), np.full((100, 10), 555)))
imv.setImage(img=data, autoLevels=False, autoHistogramRange=False)
cmap = pg.colormap.getFromColorcet("glasbey")
cmap.setMappingMode(cmap.REPEAT)
imv.setColorMap(cmap, )
imv.setLevels(min=0, max=256)
colors_length = len(cmap.getColors())
print(f"colors length {colors_length} ")
imv.show()
# imv_masked.show()
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()