I am trying to convert 2xN numpy array into two colormaps. That is, I want to turn each row of the array to separate arrays of RGBA values. I am using the following code.
import numpy as np
import matplotlib.colors as clrs
location = np.array([[0.72, 1.69, 4.85, 1.20, 0.45, 2.13, 3.65 , 4.03, 3.27, 4.59],
[4.02, 3.73, 2.95, 0.22, 1.81, 0.45, 3.30, 4.54, 2.74, 1.14]])
normalizeX = clrs.Normalize(vmin = 0, vmax = 5)
normalizeY = clrs.Normalize(vmin = 0, vmax = 5)
normX = normalizeX(location[0,:])
normY = normalizeY(location[1,:])
mapX = clrs.Colormap('Blues')
mapY = clrs.Colormap('Greens')
colorValues_X = mapX(normX)
colorValues_Y = mapY(normY)
I would expect the colorValues_X and colorValues_Y variables to hold the RGBA arrays but I am getting an error statement which I do not understand.
The error is NotImplementedError: Abstract class only.
As far as I know, the instance of the Colormap class only requires normalized array of numbers as its input to return the RGBA array.
I don't understand what am I doing wrong. Can anyone help please?