Matlab matrix bar graph with errors

Click For Summary
SUMMARY

The forum discussion addresses the issue of adding error bars to a MATLAB bar chart where the error bars appear incorrectly positioned between two sets of data. The user provided MATLAB code that initializes two datasets, "Under" and "Outside," and attempts to overlay error bars using the errorbar function. The error bars are intended to represent the standard error values stored in the variable "E." The solution requires adjusting the error bar placement to align directly above the respective bars in the chart.

PREREQUISITES
  • Familiarity with MATLAB programming language and environment.
  • Understanding of bar charts and error bars in data visualization.
  • Knowledge of matrix manipulation in MATLAB.
  • Basic statistics, specifically the concept of standard error.
NEXT STEPS
  • Research "MATLAB errorbar function" for proper usage and parameters.
  • Learn about "MATLAB bar chart customization" to adjust error bar positioning.
  • Explore "MATLAB matrix operations" to enhance data handling skills.
  • Investigate "data visualization best practices" for effective presentation of statistical data.
USEFUL FOR

This discussion is beneficial for data analysts, researchers, and MATLAB users who are creating visualizations and need to accurately represent data with error bars in bar charts.

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
991
Replies
5
Views
8K