I would like to draw a stack plot with a colormap as given in Figure 5 of this paper. Here's a screenshot of the same

Currently, I am able to draw a scatter plot of a similar nature.

I would like to convert this scatter plot to a stack plot with a colormap. I am bit lost on ideas to do this. My initial guess is that for each (x,y) point I need list of z points on the colormap spectrum. I wonder however, if there's a simpler way to this. Here's my code to generate the scatter plot with color map
cm = plt.cm.get_cmap('RdYlBu')
plt.xscale('log')
plt.yscale('log')
sc = plt.scatter(x, y, c=z, marker ='x', norm = matplotlib.colors.Normalize(vmin= np.min(z), vmax=np.max(z)), s=35, cmap=cm)
plt.colorbar(sc)
plt.show()
Edit
I feel I need to find a way to convert the z-array to multiple z-arrays - one for each bin on the color bar. I can then simply create a stacked area chart from these derived z-arrays.
Edit 2
I followed Rutger's code and was able to produce this graph for my data. I wonder why there's an issue with the axes limits.


stackplotexamples in the gallery: matplotlib.org/examples/pylab_examples/stackplot_demo.html But when looking at your data i doubt if you want that, a stackplot is meant for distinct series. It seems like you are more looking for a contour plot: matplotlib.org/examples/pylab_examples/contour_image.htmlcontourf.normif all you're doing is just a linear scale. Leaving thenormargument out entirely would have exactly the same effect as your current code. Hope that helps a bit!stackplot. (For example, notice the "island" in figure that you're trying to copy.) If you were going to try to usestackplot, you'd have to first usecontourto identify lines of a constant "z" value before plotting them withstackplot.contourfbasically just does this in one step, but it plots things more flexibly thanstackplotever could (for example, it will happily handle "islands": a.k.a. closed contours).