Difference between errorbar and errorbarxy (function)

2 views (last 30 days)
Hello,
I'm calculating and plotting a mean-Values and standard deviation:
If I plot it via errorbar, I get:
....
errorbar(M1(:,2),M1(:,1),S1(:,2),S1(:,1),'-o','both','LineWidth',1.5,'MarkerFaceColor','cyan','MarkerSize',10,'MarkerEdgeColor','black','DisplayName',label1{1})
....
errorbar(M2(:,2),M2(:,1),S2(:,2),S2(:,1),'-s','both','LineWidth',1.5,'MarkerFaceColor','yellow','MarkerSize',10,'MarkerEdgeColor','black','DisplayName',label2{1})
...
If I plot with errorbarxy function, I get:
errorbarxy(M1(:,2),M1(:,1),S1(:,2),S1(:,1))
....
errorbarxy(M1(:,2),M1(:,1),S1(:,2),S1(:,1))
....
Why, I'm getting different line length? I tnink an errorplot has a wrong length, because there are each one value for x-axis and y-axis?! What is the better way to plot main + std?
values are:
M1 =
0.0570 0.9098
0.0860 0.8615
0.7741 0.1542
0.9682 0.0200
0.9874 0.0016
M2 =
0.0591 0.9049
0.2164 0.7222
0.7954 0.1332
0.9703 0.0091
0.9761 0.0082
S1 =
0.0196 0.0220
0.0356 0.0585
0.0349 0.0636
0.0354 0.0347
0.0027 0.0027
S2 =
0.0323 0.0461
0.2140 0.2619
0.2021 0.1885
0.0216 0.0158
0.0171 0.0141
  4 Comments
dpb
dpb on 6 Jul 2020
>> which -all errorbar
C:\ML_R2019b\toolbox\matlab\specgraph\errorbar.m
errorbar is a built-in method % tall method
>> which -all errorbarxy
'errorbarxy' not found.
>>
errorbarxy is NOT a TMW-supplied function but there is one for the job; my recommendation is to use it.
The FEX submission may be just perfectly fine, but why throw confusion between two functions that may have chosen different input arrangements into the mix besides?
Nik Rocky
Nik Rocky on 6 Jul 2020
Sorry, it was to late and my brain was down.
I have a solution with standard errobar:
errorbar(M2(:,2),M2(:,1),S2(:,2),S2(:,2),S2(:,1),S2(:,1),'-s','LineWidth',1.5,'MarkerFaceColor','yellow','MarkerSize',10,'MarkerEdgeColor','black','DisplayName',label2{1})
I have to define xpos and xneg, ypos and yneg
So just scribe the same two times =)

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 6 Jul 2020
See this example from the documentation for errorbar.
  1 Comment
Nik Rocky
Nik Rocky on 6 Jul 2020
Yes, thank you! I solve it by writing two time a values for xpos and xneg, ypos and yneg =)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!