c = [25;55];names = {'GR = 5.57' ; 'GR = 6.17'};y = [604 603 ; 903 903 ; 1083 1083]';h = bar(c,y,'FaceColor','flat');set(gca, 'XTickLabel', names , 'TickLabelInterpreter', 'latex', 'FontSize' , 13); % , 'TickLabelInterpreter', 'latex'
ylabel({'\% contribution'},'Interpreter','latex', 'FontSize' , 14) % ,'Interpreter','latex'
xlim = get(gca,'xlim');hold onplot(xlim,[925 925],'LineStyle','--','Color','r','LineWidth',1.5)
In the code given above, I want to color those bars whose value is greater than 925 as red and those with less than 925 as green. I have refered to a lot of Matlab discussions regarding coloring of bar graph but nothing seems to work.
Is there a method also to have two x axis labels? Where I label each bar in a group and I label the group as well?
Thanks in advance.
Best Answer