Is It Possible to Add Pop-Up Text When Clicking on a Specific Line In Plot

조회 수: 4 (최근 30일)
EvanThomas
EvanThomas 2017년 9월 13일
댓글: Stephen23 2017년 9월 13일
Hi, I am running large Monte Carlo sets and create a summary plot for Downrange vs Altitude for all runs in one figure/plot. I am wondering if there is a way I can make it so when I click on a specific line in that figure/plot it will tell me the run number for that specific line on the downrange vs. altitude plot.
Or, to put that another way, can you add custom "pop-up text" that appears when clicking on a plot line?
Thanks!

답변 (1개)

Stephen23
Stephen23 2017년 9월 13일
편집: Stephen23 2017년 9월 13일
Sure: add a ButtonDownFcn function for each line object:
Within that function you can create some dialog box or add/change text inside the axes, whatever suits your needs best. Note that you do not need to create a totally separate function for each line but can simply pass an integer or other identifier (e.g. the run number) as the third input to the function.
  댓글 수: 2
EvanThomas
EvanThomas 2017년 9월 13일
Thanks, I'll check this out. I actually figured out another way to do it. Basically, I added the run number into the line object tag. Then used the data cursor management object to display not only the X,Y values, but also the Run Number, which was available via my tag in the DCM object.
The ButtonDownFcn sounds like it has the potential to be cleaner!
Stephen23
Stephen23 2017년 9월 13일
Actually the data cursor is probably the way to go.

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

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by