0

I have the following plot:

y = [-2.75 -2.91; -0.48 -0.44];
X = categorical({'AWS1','AWS2'});
bar(X,y)
set(gca, 'fontsize', 14);
ylim([-3 1])
box on
grid on

How can I add an uncertainty bar around the blue bars only (-2.75 +/- 0.22 and -0.48 +/- 0.68)?

Thanks!

user5618251
  • 317
  • 1
  • 9
  • In R2019b and later, use [XEndpoints](https://www.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.bar-properties.html#mw_3d0c5b61-b082-4c79-b9c6-a21152ae26ff) – X Zhang Jul 12 '23 at 13:51
  • @XZhang That gives you the coordinates of the end points of the bars, it doesn’t add error bars. – Cris Luengo Jul 12 '23 at 14:17
  • Ah yes, that and [errorbar](https://www.mathworks.com/help/matlab/ref/errorbar.html) – X Zhang Jul 12 '23 at 14:33

0 Answers0