I am using pcolormesh on a 2-D NumPY array of points M, so
pcolormesh(X,Y,M)
plots a grid of colors where the X-axis range labels correspond to X[i], Y-axis range labels correspond to Y[j], and the color plotted at point (i,j) corresponds to the level of M[i,j].
I would also like to plot the same thing but where I have a 1-D array M[i], and the color plotted at point (X[i], Y[i]) corresponds to the level of M[i].
I don't see any out of the box solution for this in matplotlib. Is there one? This is the closest I could come up with, taking a cue from an answer to this question:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
def intensityplot(x,y,z):
z=z/z.max()
colors = cm.rainbow(z)
for X,Y,Z in zip(x,y,colors):
plt.scatter([X],[Y], color=Z)