I would like to plot say a sine function for which I have created two arrays, x and y, where y=sine(x). Now each point (x,y) has an associated z variable defined in a third array z. I would like to plot y with a heat map such that various points on the sine function have different colors based on the z value and the rest of the plot is not colored. An example of such a plot is attached.
I tried imagsc(x,y,z) but that did not work. Any hints would be appreciated.