Basically, I\'d like to make something like the following (triangles not squares as is typically used with plt.matshow).
One could start with four 2D arrays, each
See the example matplotlib.pyplot.tripcolor(*args, **kwargs) in the matplotlib documentation here.
Here is a simplyfied version of want you need:
import matplotlib.pyplot as plt
import numpy as np
xy = np.asarray([
[-0.01, 0.872], [-0.080, 0.883], [-0.069, 0.888], [-0.054, 0.890]])
x = xy[:, 0]*180/3.14159
y = xy[:, 1]*180/3.14159
triangles = np.asarray([[3, 2, 0] , [3, 1, 2], [ 0, 2, 1] ,
[0, 1, 2]])
xmid = x[triangles].mean(axis=1)
ymid = y[triangles].mean(axis=1)
x0 = -5
y0 = 52
zfaces = np.exp(-0.01*((xmid - x0)*(xmid - x0) +
(ymid - y0)*(ymid - y0)))
plt.figure()
plt.gca().set_aspect('equal')
plt.tripcolor(x, y, triangles, facecolors=zfaces, edgecolors='k')
plt.colorbar()
plt.title('tripcolor of user-specified triangulation')
plt.xlabel('Longitude (degrees)')
plt.ylabel('Latitude (degrees)')
plt.show()
You should get the following picture: