I wonder how to make this kind of color map: enter image description here
I hope to draw this kind of map. I have two values for each grid already(which is enter image description here(p,et),(R,et)), so I need how to adopt this colormap with my correlation values. But I have no idea how to make this colormap. reference : A. J. Teuling.A regional perspective on trends in continental evaporation. Thanks!
You can do it along these lines:
import cv2
import numpy as np
def get_rgb(two_d_pixels):
theta = np.arctan(two_d_pixels[1,:] / two_d_pixels[0,:])
r = np.sqrt(two_d_pixels[1,:]**2 + two_d_pixels[0,:]**2)
hue = (theta+3.14/2) * 128./(3.14) # 127 max for hue
sat = (r/np.sqrt(2)) * 255 #255 max for sat
H,W = two_d_pixels.shape[1:3]
retval = np.zeros([H,W,3],dtype = np.uint8)
retval[:,:,0] = hue
retval[:,:,1] = sat
retval[:, :, 2] = 255
retval = cv2.cvtColor(retval,cv2.COLOR_HSV2BGR)
return retval
two_d_image = np.mgrid[-1:1:0.1,-1:1:0.1]
rgb = get_rgb(two_d_image)
cv2.imshow('ok',rgb)
cv2.waitKey(0)
This shows the map from ((-1,1),(-1,1)) to RGB, example here . I used mgrid to make a 2*X*Y tensor , the rho_p and rho_rg are the values in those two tensor planes. If you need the colormap exactly like in the paper you can adjust the formulas for hue,sat , keeping in mind that arctan ranges from -pi/2 to pi/2 and r will range from sqrt(2) to 0