MATLAB Answers

How to differentiate range color on frequency counts plot

2 views (last 30 days)
I would like to use a different color only for a certain range color especially around the median range of frequency counts.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Mar 2020
Here is an example code to change the color to red for a certain range around the median of frequency counts.
x = [ 1 3.3 7 10 20 25 25 25 30 30 30 30 30 30 32 32 32 40 50 60];
mask = (22 < x) & (x < 33);
bin_edges = 1:1:60;
figure
histogram(x(~mask),bin_edges);
hold on
histogram(x(mask),bin_edges,'FaceColor','red');
hold off

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags

No tags entered yet.

Products


Release

R2019b

Translated by