MATLAB: How to change the line color in the output of imhist

Image Processing Toolboximhist

imhist provides the output in blue lines;i want to change it into say either red or green

Best Answer

For precise control, plot it yourself with bar() and then set the 'EdgeColor' and 'FaceColor' properties in the bar() function:
img = imread('moon.tif');
[counts, grayLevels] = imhist(img, 64);
bar(grayLevels, counts, 'EdgeColor', 'r', 'FaceColor', 'c', 'BarWidth', 0.95);
Makes cyan bars with red outlines.