The following code is an example to use pyqtgraph colormap with an imageview. Maybe this could help you
# ## Set a custom color map # colors = [ # (0, 0, 0), # (45, 5, 61), # (84, 42, 55), # (150, 87, 60), # (208, 171, 141), # (255, 255, 255) # ] # cmap = pg.ColorMap(pos=np.linspace(0.0, 1.0, 6), color=colors) # imv.setColorMap(cmap) On Sunday, 18 June 2017 00:27:57 UTC+2, wot wrote: > > First, let me add my praise to that of others. I needed a fast plotting > program and this was significantly better than matplotlib. This being said, > I have a small problem that probably has a simple solution but I cannot > find it. > > To get a color map for plotting multiple lines on a graph I currently use > the following code: > > from matplotlib.pyplot import get_cmap > import numpy as np > > numofLines = 5 > cMapType = 'viridis' > colorMap = get_cmap(cMapType) # get_cmap is matplotlib object > > colorList = np.linspace(0, 1, numofLines) > lineColors = colorMap(colorList) > > # convert to RGB*255 > lineColors = lineColors * 255 > lineColors = lineColors.astype(int) > > print lineColors > > I would like to get away from using maplotlib for this purpose but cannot > see how to do this using pyqtgraph. I want to give the user the option to > use different color maps 'viridis', 'gist_rainbow' etc. I can store the > colormap data in a file with other data if necessary. > -- 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/26e97cad-c967-4bd3-b3a9-2ca18f5a8a7d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
