How do I go from a 2D numpy array where I only have three distinct values: -1, 0, and 1 and map them to the colors red (255,0,0), green (0,255,0), and blue (255,0,0)? The array is quite large, but to give you an idea of what I am looking for, imagine I have the input
array([[ 1, 0, -1],
[-1, 1, 1],
[ 0, 0, 1]])
I want the output:
array([[(0, 0, 255), (0, 255, 0), (255, 0, 0)],
[(255, 0, 0), (0, 0, 255), (0, 0, 255)],
[(0, 255, 0), (0, 255, 0), (0, 0, 255)]])
I could for-loop and have conditions but I was wondering if there is a one or two liner using a lambda function that could accomplish this? Thanks!