the colour parameter in set_UVC() for quivering requires a float array. How to construct an array of colours using float numbers?
color_float = np.array([[1.,0.,0.]])
...
Q.set_UVC(U,V,color_float)
Any help is appreciated.
the colour parameter in set_UVC() for quivering requires a float array. How to construct an array of colours using float numbers?
color_float = np.array([[1.,0.,0.]])
...
Q.set_UVC(U,V,color_float)
Any help is appreciated.
Please see https://matplotlib.org/3.3.3/tutorials/colors/colormapnorms.html for a longer explanation. The very short version is:
from matplotlib.colors import Normalize
from matplotlib.cm import get_cmap
# class to map data to the required range
norm = Normalize(min=your_min, max=your_max)
# maps [0, 1] -> RGBA
cmap = get_cmap('viridis')
# put data in range [0, 1]
normed_data = norm(your_data)
# get array of RGBA
colour_array = cmap(normed_data)
Hopefully that helps!