how do i control the histograms generated by scatterhist?

4 views (last 30 days)
In scatterhist() output, I want standard bar histogram (vs. 'kernel','on' line plots). Need to control histogram color. The scatterhist() docs only describe how to control the scatter plot marker colors, but not the histograms. The 'FaceColor' parameter that normally controls histogram color is not recognized by scatterhist().

Answers (1)

Adam Danz
Adam Danz on 4 Oct 2018
The output to scatterhist() is a vector of handles to the scatter plot, the x histogram, and the y histogram axes, respectively. To change the face color of a bar plot, you just need to get the children of the histogram axis and then change the FaceColor. The example below changes the face color of the x axis histogram.
h = scatterhist(...);
h(2).Children(1).FaceColor = 'r'

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!