Bar chart colors depending on their value
Show older comments
(in MATLAB 2014a)
I would like to plot visuals to verify if a set of data complies with the requirements values.
req = [10,5,3];
data=[9,6,3];
To plot the following bar chart I used:
bar(req,0.5)
newXticklabel = {'label1','label2','label3'};
set(gca,'XtickLabel',newXticklabel);
hold on
bar(data,0.25,'g')
hold off
My question is: how do I change the color of one bar in red if the data is lower than the requirement value ?

Accepted Answer
More Answers (0)
Categories
Find more on Bar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!