Identify points on a plot with mouse clicks
v=identify(x,y) v=identify(x,y,plotsymbol) v=identify(x,y,plotsymbol,textvector)
a n-by-1 matrix of doubles
a n-by-1 matrix of doubles
a 1-by-1 matrix of strings, the plot symbol (default = "*")
a n-by-1 matrix of strings, or a n-by-1 matrix of doubles, the labels (default = 1:n)
a n-by-1 matrix of doubles, the indices of selected points
This routine plots x versus y and waits for mouse clicks to identify points. This allows to interactively identify the points in a plot.
Click with left button on points and end with middle button.
The plotsymbol
argument is used to specify
the way the points are plotted, as given by the
LineSpec
argument of plot
.
In other words, the statement used to plot the points is
plot(x,y,plotsymbol)
If no point is selected, the function returns [].
x = distfun_normrnd(0,1,30,1); y = 2+3*x+distfun_normrnd(0,1,30,1); scf(); v=identify(x,y) // Set the plot symbol scf(); v=identify(x,y,"bo") // Use a text vector x = distfun_normrnd(0,1,10,1); y = 2+3*x+distfun_normrnd(0,1,10,1); textvector=strsplit("abcdefghij") scf(); identify(x,y,"bo",textvector) // With a matrix of strings x = distfun_normrnd(0,1,4,1); y = 2+3*x+distfun_normrnd(0,1,4,1); textvector=[ "john" "paul" "george" "ringo" ]; scf(); identify(x,y,"bo",textvector) // With textvector a vector of doubles x = distfun_normrnd(0,1,4,1); y = 2+3*x+distfun_normrnd(0,1,4,1); textvector=10:14; scf(); identify(x,y,"bo",textvector) | ![]() | ![]() |