colormap

Creating custom colormap for opencv python

Creating custom colormap for opencv python Question: I created a custom colormap in a text file, read from the python 3.6. To map each color in for loop it takes approx. 9 seconds. Here is the snippet: for x in range(256): # z = int(rgb_c[x][0]) # r = int(rgb_c[x][1]) # g = int(rgb_c[x][2]) # b …

Total answers: 1

Add alpha to an existing matplotlib colormap

Add alpha to an existing matplotlib colormap Question: I’d like to make an overlay of several hexbin plots, but with builtin colormaps only the last one is visible. I don’t want to construct a colormap de novo. How one would add linear alpha to the colormap without knowing the inner structure of the colormap beforehand? …

Total answers: 3

Extract matplotlib colormap in hex-format

Extract matplotlib colormap in hex-format Question: I am trying to extract discrete colors from a matplotlib colormap by manipulating this example. However, I cannot find the N discrete colors that are extracted from the colormap. In the code below I’ve used cmap._segmentdata, but I’ve found that it is the definition of the entire colormap. Given …

Total answers: 2

Cyclic colormap without visual distortions for use in phase angle plots?

Cyclic colormap without visual distortions for use in phase angle plots? Question: I’m looking for a good circular/cyclic colormap to represent phase angle information (where the values are restricted to the range [0, 2π] and where 0 and 2π represent the same phase angle). Background: I’d like to visualize normal modes by plotting both the …

Total answers: 6

Defining the midpoint of a colormap in matplotlib

Defining the midpoint of a colormap in matplotlib Question: I want to set the middle point of a colormap, i.e., my data goes from -5 to 10 and I want zero to be the middle point. I think the way to do it is by subclassing normalize and using the norm, but I didn’t find …

Total answers: 10

How to pick a new color for each plotted line within a figure

How to pick a new color for each plotted line within a figure Question: I’d like to NOT specify a color for each plotted line, and have each line get a distinct color. But if I run: from matplotlib import pyplot as plt for i in range(20): plt.plot([0, 1], [i, i]) plt.show() then I get …

Total answers: 8

Set Colorbar Range in matplotlib

Set Colorbar Range in matplotlib Question: I have the following code: import matplotlib.pyplot as plt cdict = { ‘red’ : ( (0.0, 0.25, .25), (0.02, .59, .59), (1., 1., 1.)), ‘green’: ( (0.0, 0.0, 0.0), (0.02, .45, .45), (1., .97, .97)), ‘blue’ : ( (0.0, 1.0, 1.0), (0.02, .75, .75), (1., 0.45, 0.45)) } cm …

Total answers: 4