M = len(SOMA)
N = len(Q)
x = np.arange(M + 1)
y = np.arange(N + 1)
xs, ys = np.meshgrid(x, y)
zs1 = result['PRECISION']
zs2 = result['QPRECISION']
zs1 = zs1.astype(dtype=float)
zs2 = zs2.astype(dtype=float)
triangles1 = [(i + j*(M+1), i+1 + j*(M+1), i + (j+1)*(M+1)) for j in range(N) for i in range(M)]
triangles2 = [(i+1 + j*(M+1), i+1 + (j+1)*(M+1), i + (j+1)*(M+1)) for j in range(N) for i in range(M)]
print(np.shape(triangles1))
print(np.shape(triangles2))
fig = plt.figure()
ax = fig.add_subplot(111)
triang1 = Triangulation(xs.ravel(), ys.ravel(), triangles1)
triang2 = Triangulation(xs.ravel(), ys.ravel(), triangles2)
newcmp = ListedColormap(['#DAFFAC','#8FFD03'])
img1 = ax.tripcolor(triang1, zs1, cmap=plt.get_cmap('Blues'))
img2 = ax.tripcolor(triang2, zs2, cmap=plt.get_cmap(newcmp))
cb1 = plt.colorbar(img2, ax=[ax], ticks=[5, 4] , location='left',label='Q based Precision', pad=0.15)
cb2 = plt.colorbar(img1, ax=[ax], ticks=[5, 4, 3, 2, 1, 0],location='right',label='Suppported Precision', pad =0.05)
labels = np.arange(4, int(5) + 1, 1)
cb1.set_ticks([4.25, 4.75])
cb1.set_ticklabels(labels)
for tick in ax.xaxis.get_majorticklabels():
tick.set_horizontalalignment("center")
plt.xlim(x[0], x[-1])
plt.ylim(y[0], y[-1])
plt.xlabel("SOMA")
plt.ylabel("Q")
x = np.arange(0.5,22,1) #range of SOMA
y = np.arange(0.5,14,1) #range of Q
plt.xticks(x, SOMA, rotation=90)
plt.yticks(y, Q)
plt.title(PLOT_TITLE)
plt.savefig('fig.png',bbox_inches='tight')
plt.show()