How to add legends?
Show older comments
How to add Legends to this code according to the colours? I am getting different legend symbol for this code.
r1=[19.38 65.3 15.32;16.66 62.13 21.21;18.21 58.31 23.49;19.11 59.95 20.94;16.53 67.27 16.19;19.41 63.87 16.72];
Std= [1.2141 3.0580 3.0398]
Mean=[18.2167 62.8050 18.9783]
Bar=bar(Mean,0.4, 'FaceColor', 'flat');
Bar.CData(1,:)=[0.8500 0.3250 0.0980]
Bar.CData(2,:)= [1 0 0]
Bar.CData(3,:)= [0 1 0]
set(gca,'FontSize',12,'XTick',[1 2 3 ],'XTickLabel',{'Empty space','Higher Diameter','Lower Diameter' });
xlabel('Percentage of spcace occupied ')
ylabel('Mean')
errbar=[Std]
yd=[Mean]
hold on
for k1 = 1:3
errorbar([1:3]+.01*(k1-2), yd(k1,:), errbar(k1,:), '.k', 'LineWidth',1)
end
hold off
Looking for some cordial help. Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Legend 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!