Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is it possible to select a point on a graph and get its exact coordinates (as they appear in data file)

29 views
Skip to first unread message

dpimanu

unread,
May 19, 2004, 11:38:25 PM5/19/04
to
Sorry if this question has already been posted.
My datafile looks like this:
10/MAY/2004 00:45:10 26
10/MAY/2004 00:47:19 24
10/MAY/2004 00:48:28 40
10/MAY/2004 00:50:10 27
...

With the following program I managed to plot my data file:
reset
set title "Pick Release"
set xlabel "Date"
set ylabel "Duration \n(in s)"
set xdata time
set timefmt "%d/%b/%Y"
set xrange ["10/MAY/2004":"18/MAY/2004"]
set format x "%m/%d"
set timefmt "%d/%b/%Y %H:%M:%S"
plot 'F:\temp\e.lst' using 1:3 with l

Now when I move the cursor on the graph I see x,y coordinates of the
pointer at the bottom left of the graph but the x looks like
1.373890e+08 (I guess it's a number of second since some time in the
past). I think it's not possible to change the format of x of the
pointer into a date format (i.e. something like "10/MAY/2004 00:50:10"
instead of a number of seconds). So I was trying to select a point and
get the coordinate of this point (as they appear in the data file) but
I couldn't do it.

1) Is it possible to change the pointer x format?
2) Is it possible to get coordinates of a point as they appear in data
file by selecting (clicking) on the point on the graph?

Thanks,

Ethan Merritt

unread,
May 20, 2004, 12:37:10 AM5/20/04
to
In article <6264f113.0405...@posting.google.com>,

dpimanu <sv...@yahoo.com> wrote:
>
>1) Is it possible to change the pointer x format?

Yes, hitting '1' in the plot window will successively
cycle through different output formats for the mouse coordinates.
This by itself will only get you pre-defined formats,
but there is also a 'set mouse format' command that
may or may not get you the rest of the way to what you want.

>2) Is it possible to get coordinates of a point as they appear in data
>file by selecting (clicking) on the point on the graph?

It is possible to get the coordinates
(see the demonstration file mousevariables.dem)
but they will not be "as they appear in the data file".

--
Ethan A Merritt

Jason Quinn

unread,
May 21, 2004, 8:42:53 PM5/21/04
to
mer...@u.washington.edu (Ethan Merritt) wrote:
> It is possible to get the coordinates
> (see the demonstration file mousevariables.dem)
> but they will not be "as they appear in the data file".

I have a follow up question. I just discovered gnuplot last night
and was amazed! I wish I had learned it years ago. Previously I was
using Super Mongo. I'm writing an analysis program and I want to
generate scripts to view a data file. My question is if it's possible
to have an x-y plot where it shows you a label from a third column
such as an ID. That is, if the data file were like this:

#ID X Y
Jason 12 24
Mike 83 28
John 10 71
Tim 83 90

where, for example, if I were to move the mouse over the x=83 y=28
point, it shows "Mike". Is it possible to do this? Starting with which
version? I'm sorry if this is a basic question. However, I am really
amazed by gnuplot from what I've seen so far in version 3.7.

Thanks in advance,
Jason

Ethan Merritt

unread,
May 21, 2004, 10:12:57 PM5/21/04
to
In article <bd4b8054.04052...@posting.google.com>,

Jason Quinn <jason...@yahoo.com> wrote:
>
> I want to
>generate scripts to view a data file. My question is if it's possible
>to have an x-y plot where it shows you a label from a third column
>such as an ID. That is, if the data file were like this:
>
>#ID X Y
>Jason 12 24
>Mike 83 28
>John 10 71
>Tim 83 90
>
>where, for example, if I were to move the mouse over the x=83 y=28
>point, it shows "Mike". Is it possible to do this? Starting with which
>version? I'm sorry if this is a basic question. However, I am really
>amazed by gnuplot from what I've seen so far in version 3.7.

You really ought to start with the current version, which is 4.0
However, even 4.0 is not quite so snazzy as you are asking for.

The answer is yes, it's possible, but it would require a lot of
scripting. You could use mouse feedback to get the coordinates,
and then your script would have to match them up with the
desired line in the file to construct a "set label" command and
then issue a "replot".

--
Ethan A Merritt

Jason Quinn

unread,
May 23, 2004, 4:27:04 PM5/23/04
to
mer...@u.washington.edu (Ethan Merritt) wrote:
> You really ought to start with the current version, which is 4.0
> However, even 4.0 is not quite so snazzy as you are asking for.
>
> The answer is yes, it's possible, but it would require a lot of
> scripting. You could use mouse feedback to get the coordinates,
> and then your script would have to match them up with the
> desired line in the file to construct a "set label" command and
> then issue a "replot".

I suppose it wouldn't take too much scripting. I'll likely end up
doing it. I can't help but wonder why this isn't already in it by
default. It seems like it would be pretty easy to program and the
return, in data visualization, seems high.

Thanks,
Jason

Ethan Merritt

unread,
May 23, 2004, 10:26:50 PM5/23/04
to
In article <bd4b8054.0405...@posting.google.com>,

Jason Quinn <jason...@yahoo.com> wrote:
>
> I suppose it wouldn't take too much scripting. I'll likely end up
>doing it. I can't help but wonder why this isn't already in it by
>default. It seems like it would be pretty easy to program and the
>return, in data visualization, seems high.

I can think of a number of difficulties off the top of my
head (what if there are multiple overlapping curves? what if
you click on a curve in between two points? Can it be extended
to 3D plots? Just where are these pop-up strings stored?).

Anyhow, if you'd rather spend your time adding this feature
to gnuplot rather than spend it on external scripting, feel
free to upload the patchset to SourceForge.

Just be aware that gnuplot tries to support a huge variety
of output devices, most of which don't know anything about
mouse feedback. That said, if you're going to add the feature
you should at try to code it so that it benefits all of the
terminals that *do* support interactive mouse input.

--
Ethan A Merritt

0 new messages