MATLAB: Using a colormap to match a contour to a histogram

histogram contourf colormapMATLAB

I am regenerating cscan TOF data ( contourf(xscale, yscale, cscan, 40,'linestyle','–') ) and I would am trying to display a histogram of the data such that the bar colors will be the same a shown in the histogram (say red in the contour = 400 ns would have the histogram bar at 400 also be red). Is there an easy way to assign the bars using the colormap?

Best Answer

Thanks for the help. That's what I'm trying do, although this is kind of a brute force way of doing it. I was sort of hoping that there would be a way to set the color map directly to the histogram. I guess I'll need to make a function for this.