# Changing colour of ImageHistogram

Is there a way I can show the three ImageHistogram[]'s in different colours?

Show[ ImageHistogram[edit[[1]], Appearance -> "Separated"], ImageHistogram[edit[[2]], Appearance -> "Separated"], ImageHistogram[edit[[3]], Appearance -> "Separated"], ]

• In theory, you should be able to use something like PlotStyle -> Array[ColorData[61], 3], but it does not seem to work here... – J. M.'s ennui Feb 4 at 11:09
• @J.M. ChartStyle doesn't seem to work either – Teabelly Feb 4 at 11:40
• Someone else would need to confirm, but I think this is worth reporting to Support. – J. M.'s ennui Feb 4 at 11:45

The second suggestion by @kglr seems like a natural approach (which ensures the result still has Head Graphics and not Image).

Another solution would be to manually make a Histogram for each channel:

GraphicsColumn[
]


However, this also serves as more of an extended comment to highlight a curious behaviour (as hinted by the comments above). Note that ImageHistogram clearly has special logic for handling RGB images. This can be seen by comparing a 4-channel image ColorSpace, e.g. CMYK:

With[{cmyk = ColorCombine[ColorSeparate[edit1, "CMYK"], "CMYK"]},
ImageHistogram[cmyk, Appearance -> "Separated"]]


Curiously, adding PlotStyle -> Array[ColorData[57], 4] also fails on this example, returning all histograms with the last specified color.
Perhaps this is indeed worth reporting to WR Support.

You can use ColorReplace to replace {Red, Green, Blue} with desired colors:

ClearAll[colReplace]
colReplace = ColorReplace[ImageHistogram[#, Appearance -> "Separated", ImageSize -> Large],
Thread[{Red, Green, Blue} -> #2]] &;


Examples:

edit1 = Import["https://i.stack.imgur.com/jUr0a.png"]


edit2 = ImageAdjust[edit, .1];

edit3 = ColorBalance[edit, .1];

Row[{edit1, edit2, edit3}, Spacer[10]]


colReplace[edit1, ColorData[97] /@ {1, 2, 3}]


Show[MapThread[colReplace,
{{edit1, edit2, edit3}, Partition[ColorData[97] /@ Range[9], 3]}]]


You can also use ReplaceAll to get the same results:

ClearAll[replaceColors]
replaceColors = ReplaceAll[Thread[{Red, Green, Blue} -> #2]]@
ImageHistogram[#, Appearance -> "Separated", ImageSize -> Large] &;