Bartlomiej Lewandowski
Bartlomiej Lewandowski

Reputation: 11180

Get relative mouse coordinates of a plot

i have a plot:

t = 1:0.001:10;
plot(t,t);

now i wish to know which point i have clicked on the new plot. Is this possible?

I know there is the get(0,'PointerLocation'); method, but this gives me the absolute screen coordinates.

Upvotes: 1

Views: 252

Answers (1)

user815923
user815923

Reputation: 56

The function [x,y] = ginput(n) (see here) probably fits your needs.

Upvotes: 3

Related Questions