'Histogram function plots different colours from those requested

I"m trying to color-code each of 4 histograms using a predefined color scheme. Here's a minimal working example:

colours = [0 32 96;
    192 0 0;
    71 207 255;
    255 143 143;
    ] / 255;

for i=1:4
    x = randn(1,100);
    subplot(1,4, i)
    values = histogram(x,   'FaceColor', colours (i, :));
end

However, in the image I'm getting, the colors are actually (slightly) different, for instance for the first histogram I get (102,121,160) instead of (0,32,96): enter image description here



Solution 1:[1]

The default histogram FaceAlpha is 0.6 (ref.). Setting it to 1 should do the trick.

histogram(x,'FaceColor',[0 1 0],'FaceAlpha',1);

Very cumbersome and unexpected.

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Brethlosze