MATLAB Answers

How to create an errorbar with each column representing a state?

조회 수: 1(최근 30일)
Max Behr
Max Behr 17 Jun 2020
댓글: Max Behr 18 Jun 2020
Hello,
I would like to create an errorbar with each column of "test" represents a state (Base value, preperation value, test value, rest value)
test =
0.8003 0.9157 0.6557 0.9340
0.1419 0.7922 0.0357 0.6787
NaN 0.9595 0.8491 0.7577
test_SE=nanstd(test)/sqrt(length(test))
test_SE =
0.2328 0.0434 0.2125 0.0653
states =
1×4 cell array
{'Base'} {'Preperation'} {'Testing'} {'Resting'}
If I try to do it with a boxplot it works perfecty // boxplot(test,states) //. But unfortunately I can' find a way to do it with errorbars.
I would be very thankful if somebody could help me out

  댓글 수: 0

댓글을 달려면 로그인하십시오.

채택된 답변

Aayush Shah
Aayush Shah 18 Jun 2020
Hi Max,
My understanding of your question is that you aren’t able to plot an errorbar with each column of your numerical data (Y axis) being a unique categorical column. While the errorbar in itself doesn’t let you perform this, there’s a workaround that you can try which might help in solving your issue.
A similar question has already been asked and answered by the community. Please refer to the following link:

  댓글 수: 1

Max Behr
Max Behr 18 Jun 2020
Thank you. I found the solution.
I just used this:
'XTick',[1 2 3 4]
And labeled the "ticks" with 'states'
XTickLabel,(states)

댓글을 달려면 로그인하십시오.

추가 답변(0개)

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by