hatching based of maximum of 3 different arrays - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: hatching based of maximum of 3 different arrays (/thread-19349.html) |
hatching based of maximum of 3 different arrays - Staph - Jun-24-2019 I have three numpy arrays A.shape = 72 X 144 B.shape = 72 X 144 C.shape = 72 X 144 I want to create one color map from these arrays where regions in which A is the greatest of the three will be hatched or colored red, regions where B is the max of the three will be hatched as greed and regions where C is the max blue thanks RE: hatching based of maximum of 3 different arrays - ThomasL - Jun-24-2019 untested import numpy as np A = np.random.randint(0, 255, size=(72,144)) B = np.random.randint(0, 255, size=(72,144)) C = np.random.randint(0, 255, size=(72,144)) colormap = np.zeros((72,144,3), dtype='uint8') colormap[(A>B) & (A>C),0] = 255 # red colormap[(B>A) & (B>C),1] = 255 # green colormap[(C>A) & (C>B),2] = 255 # blue |