MATLAB Matlab matrix bar graph with errors

Click For Summary
The discussion revolves around a MATLAB user encountering an issue with adding error bars to a bar chart. The user has created a bar chart with two sets of data represented in matrix form but finds that the error bars are positioned incorrectly, appearing in the middle of the two data sets instead of directly over the respective bars. The provided code snippet includes the data for two categories, "Under" and "Outside," along with their corresponding error values. The user seeks assistance in modifying the code to ensure the error bars align correctly with the bars in the chart. The focus is on achieving proper visualization of the data with accurate error representation.
Toni103
Messages
11
Reaction score
0
As in the title I have a MATLAB graph. Its a bar chart with two sets of data done in matrix form. When I try and put in error bars the way I'm used to they both go on but in the middle of the two sets of data. Any way I can make them appear over the actual bars? Any help greatly appreciated!

The code I have so far is:

close all
clear;
clc

Under = [ 5.46, 2.02, 1.17];
Outside = [7.23, 3.99, 3.2];

E = [1.162, 1.162, 1.162];

data = [Under; Outside];

Matrix = (data');

%size (Matrix)

figure (1);
bar(Matrix); hold on
errorbar(Under ,E, 'ks');
errorbar(Outside, E, 'ks');

ylabel('SNR');
xlabel('Layers of tape');
title('Optimised Settings');
 
Physics news on Phys.org
mistake post
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
791
Replies
5
Views
8K