How do I add refreshable text label to my plot?
조회 수: 18 (최근 30일)
이전 댓글 표시
Hello,
After searching the web and the Q/A in your site I have decided to beat the experts. I am creating bar figure and I would like to see the value on top of each bar. My problem is that my figure refreshes every 2 seconds via timer (which is good), but the text on the bars is accumulating. I tried all values of 'erasemode' but it didn't help. I also tried to do h = text(...) and then delete h, but it didn't solve anything. Sorry to disturb if there is a similar question and solution.
Thanks in advance, Liad.
댓글 수: 0
채택된 답변
Laura Proctor
2011년 5월 11일
I tried the following and it worked:
h = text(1,1,'hi there')
delete(h)
So I'm wondering if you would be able to show a simple example to help explain the issue.
댓글 수: 0
추가 답변 (2개)
sco1
2011년 5월 11일
The way your question reads, I'm assuming you are annotating the plot itself using the text() function?
Are you using hold?
댓글 수: 5
Fangjun Jiang
2011년 5월 13일
Once you created the text() element and get its handle ht(patlx), you can type get(ht(patlx)) in the Matlab command window to see all its properties. Then you can use set() to change most of the properties.
Start with the simplest option to create the text() element, step through to understand how it works and gradually add more options.
What do you mean "crashing"? Does it cause errors? or the figure does not show correctly? use the command drawnow() may help refreshing the figure.
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!