select line by touching with mouse

this is a equity plotted
Is it possible to select one by touching it with the mouse?

답변 (1개)

John D'Errico
John D'Errico 2025년 6월 4일
편집: John D'Errico 2025년 6월 4일

0 개 추천

"select curve?"
Well, yes, in a sense. When you plot the curve, you can supply a ButtonDownFcn, so that when you click on the curve, will initiate whatever code you write. In a very simple form, I did this:
mycallback = @(varargin) disp("yeah? what do ya want?");
plot(1:5,rand(1,5),buttondownfcn = mycallback)
Now, when I click on the curve, I see this grumpy response:
yeah? what do ya want?
But if I click on an empty part of the figure, I see nothing. The callback is only initiated when I click right on the curve.
You can be far more creative than what I did of course.

댓글 수: 1

shamal
shamal 2025년 6월 4일
편집: shamal 2025년 6월 4일
Thanks.. To be more precise I want to change the transparent color to all the other equities (and in the one I touch I keep the color) Can you give me an example how to do it?

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

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2025a

질문:

2025년 6월 4일

편집:

2025년 6월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by