MATLAB: How to write the legend in bar chart bar how to add legend for the first, second and third column? this is the code: y =[44,55,54] ;b = bar(y,0.5);bar(y) Best Answer Try thisy =[44,55,54];hold onfor i=1:numel(y) bar(i, y(i))endlegend({'first', 'second', 'third'}) Related SolutionsMATLAB: Invert or reverse Yaxis ticks in a plot or scatter graph x=1:10;y=[0.4 0.61 0.45 0.66 0.41 0.63 0.44 0.62 0.46 0.6];aH = axes;scatter(aH,x,y,'filled','bo');aH.YDir = 'reverse'; MATLAB: How to use colormap for different bars. See if this helps.y = [4.2; 4.6; 5]; %The data.s = [.3; .2; .6]; %The standard deviation.fHand = figure;aHand = axes('parent', fHand);hold(aHand, 'on')colors = hsv(numel(y));for i = 1:numel(y) bar(i, y(i), 'parent', aHand, 'facecolor', colors(i,:));endset(gca, 'XTick', 1:numel(y), 'XTickLabel', {'R0', 'R1', 'R2'})errorbar(y,s,'r'); Related QuestionHow to add a dot above y in legendTwo colors in BarsEnlarging y-Axis because text description of two points is overlappingCan we set beside each one bar graph another comparativeHow to index something in orderConnect scatter line in multiple y axisPlotting different colors of Bar graph (2016a)
Best Answer