|
From: till_hm <ti...@gm...> - 2010-09-19 09:10:59
|
Wrote a small script to do it for me.
> #logger.txt
> #use the mouse interactively and bind to a shortcut
> set mouse
> bind o "load 'mouse.txt'"
> #clear and define variables
> loggervar = ""
> mox1 = 0
> mox2 = 0
> moy1 = 0
> moy2 = 0
> loggerfn(x, y, key)=(loggervar=loggervar . ((mox1 < x && x < mox2 && moy1
> < y && y < moy2) ? key . "\n" : ""), y)
>
where hitting the o-key calls another script given by
> #mouse.txt
> #Get coordinates of the first point
> pause mouse any "Point 1?\n"
> mox1 = MOUSE_X
> moy1 = MOUSE_Y
> #Get coordinates of the second point
> pause mouse any "Point 2?\n"
> mox2 = MOUSE_X
> moy2 = MOUSE_Y
> #Clear the variable containing keys
> loggervar = ""
> #Reorder the points if necessary
> if(mox1 > mox2) motemp = mox1; mox1 = mox2; mox2 = motemp;
> if(moy1 > moy2) motemp = moy1; moy1 = moy2; moy2 = motemp;
> replot
> print sprintf("Points in x [%f:%f], y [%f,%f]:", mox1, mox2, moy1, moy2)
> print loggervar
>
Now plot your data using
> plot 'data.txt' u 1:(loggerfn(column(1),column(2),strcol(3))
>
where column 1 contains x-coordinates, 2 contains y-coordinates and 3
contains whatever labels you are interested in.
Hitting o in the interactive window now asks you for two points and prints
the labels/keys of the points contained in the specified rectangle to the
gnuplot terminal.
--
View this message in context: http://old.nabble.com/Back-reference-to-data-in-interactive-terminal-tp29744930p29750793.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|