Plot with error bars to show upper and lower bounds
14 views (last 30 days)
Show older comments
Cara Fertitta
on 2 Nov 2017
Commented: Star Strider
on 2 Nov 2017
I'm looking to generate a plot where the upper and lower bounds of the data are displayed above and below the mean. There is a package that allows you to plot the upper and lower boundaries of a curve, but I would like to do this for a scatter plot. To my knowledge, I can't use errorbar, because the anticipated inputs are standard deviations. What I need is something that frames the upper and lower bounds of the data. For instance if the mean = 10, the lower bound may be 7 and the upper bound may be 15. Ideally, in this hypothetical situation, I want a point at 10 and bar that extends from 7 to 15. Any suggestions?
0 Comments
Accepted Answer
Star Strider
on 2 Nov 2017
The errorbar error bar limits can be anything you want them to be. They are not restricted to be standard deviations or anything else.
Example —
x = 1:10; % Create Data
y = randi(9, 1, 10); % Create Data
ub = y + randi(5, 1, 10); % Create Data: Upper Bound
lb = y - randi(3, 1, 10); % Create Data: Lower Bound
figure(1)
errorbar(x, y, lb, ub, 'pg')
axis([0 11 ylim])
4 Comments
More Answers (0)
See Also
Categories
Find more on Errorbars 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!