필터 지우기
필터 지우기

How to print the value of refline on a the plot

조회 수: 2 (최근 30일)
sc1991
sc1991 2018년 6월 20일
댓글: sc1991 2018년 6월 21일
Hello! All I am using the function refline to show the min,max and mean of my dataset is there a way how I can show the value of these points on the line or at the end of the line. I tried using the function text but that function does not seem to work. Any suggestions??

채택된 답변

Adam Danz
Adam Danz 2018년 6월 20일
Why isn't text() working? Here's a demo of what your describing and text() works.
x = normrnd(10,20,1,50);
figure; plot(x, 'o')
rh = refline(0,mean(x));
text(max(xlim),mean(x),sprintf('mean=%.2f',mean(x)),'HorizontalAlignment', 'right', 'VerticalAlignment', 'bottom')
Alternatively, if you're doing a lot of labeling you can checkout lablepoints() on the exchange.
  댓글 수: 1
sc1991
sc1991 2018년 6월 21일
Thank you. it works perfectly. I was not using max (xlim). Thanks a lot once again

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by