python - Adding two pseudocolor plots in matplotlib -
i have 2 pseudocolor plot, 1 going red (1) white (0) blue (-1) , 1 going green (1) white (0).
import matplotlib.pyplot plt import numpy np = np.random.random((16,16)) b = 2*np.random.random((16,16)) - 1 plt.pcolor(a, vmax =1.0, vmin = 0.0, cmap = 'bwr') plt.savefig("bwr.png") plt.pcolor(b, vmax =1.0, vmin = -1.0, cmap = 'greens') plt.savefig("greens.png") i want able add them 1 image if 1 , b 1, yellow , if 1 , b -1, cyan. if both 0 should white. tried adding pcolors plot using opencv2:
import cv2 import numpy np r = cv2.imread('bwr.png') mi = cv2.imread('greens.png') combo = cv2.addweighted(r, 0.55, mi, 0.55, 0.2) cv2.imwrite('combo.png',combo) cv2.imshow('combo',combo) cv2.waitkey(0) cv2.destroyallwindows() but it's not producing desired output:

any ideas on how this?
Comments
Post a Comment