addBar

版本 1.0.0.0 (2.2 KB) 作者: Itamar Lerner
add error bars to a simple graph
20.0 次下载
更新时间 2017/9/25

查看许可证

Use this simple code to easily add standard error bars to an existing 2D graph.
You can determine the visual length of the bars, whether they are symmetric or only one sided, and whether they are vertical (the common case) or horizontal. You will need to pre-compute the averages and standard errors of your existing data, and plot the averages, before using this function to add the bars.
EXAMPLE:
Assume you measured the effects of different treatments on 3 groups, with 20 subjects
each. The data is stored in grp1, grp2 and grp3 (each is a 20x1 vector). Then, compute:
dataX = [1 2 3];
average of each group: dataY = [mean(grp1) mean(grp2) mean(grp3)];
standard error of each group: dataS = [std(grp1) std(grp2) std(grp3)]/sqrt(20);
bar plot of the averages: bar(dataX, dataY).
Then use this code to add error bars with: addBar(dataX,dataY,dataS,0.05,0)

引用格式

Itamar Lerner (2024). addBar (https://www.mathworks.com/matlabcentral/fileexchange/64528-addbar), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2017b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Annotations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0