How do I add error bars to scatter plots?
8 views (last 30 days)
Show older comments
MathWorks Support Team
on 12 Dec 2016
Answered: MathWorks Support Team
on 15 Dec 2016
I have a scatter plot and want to add error bars. The "errorbar" function is not giving me correct results. How do I do this?
Accepted Answer
MathWorks Support Team
on 12 Dec 2016
The function "scatter" does not currently support error bars. However, these can be achieved by overlaying the results of "errorbar" on top of "scatter", like so:
>> x = [1,2,3];
>> y = x.^2;
>> scatter(x,y);
>> axis([0,4,0,10]);
>> hold on;
>> err = ones(size(x));
>> errorbar(x, y, err, 'LineStyle','none');
An enhancement request has been submitted for this feature so it will be considered for future releases of MATLAB.
0 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!