'How to draw a colorful 1D histogram in matlab

I have a 1D array X which contains the statistical data of correlation coefficients, and I want to plot a colorful histogram. I use the following code:

histogram(X,10)

which can create a histogram with single color, now I want to plot a histogram with each single bar having different colors. But the 'FaceColor' option can only adjust the total color of the entire plot. Can anyone tells me how to achieve that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source