How to highlight part of a Histogram Plot based on a threshold value
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
If I am plotting data using:
H=histogram(DATA,5,'Normalization','pdf');
For simplicity lets say
DATA=1:10;
And want to highlight all values on the histogram plot using a threshold (i.e. highlight all values less than or equal to 4)
How would I accomplish this?
Thank you in advance.
0 commentaires
Réponses (1)
KSSV
le 27 Oct 2017
data = randperm(20,10) ;
figure
hold on
for i=1:length(data)
h = bar(i, data(i));
if data(i) <=10
col = 'r';
else
col = 'b';
end
set(h, 'FaceColor', col)
end
1 commentaire
Ronnie Abolafia-Rosenzweig
le 27 Oct 2017
Thank you for the reply; however I am looking to keep my chart in histogram format and only highlight the area of the graph below a minimum threshold. If there is a bin with a bind edge from 0.2 to 0.3, and my threshold is 0.25, I would only like to highlight half of this bin along with all other bins with lesser values
Voir également
Catégories
En savoir plus sur Histograms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!