Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #1437

Re: hexadecimal mouse position?

From sfeam <sfeam@users.sourceforge.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: hexadecimal mouse position?
Followup-To comp.graphics.apps.gnuplot
Date 2012-10-26 11:35 -0700
Organization gnuplot development team
Message-ID <k6el5f$7ib$1@dont-email.me> (permalink)
References <32a20a28-9c24-4ab2-8f2d-67d7ac3c5a74@googlegroups.com> <k6cjli$dbv$1@dont-email.me> <b04c03f7-ff5e-42db-9b5e-1490d7ddbe44@googlegroups.com>

Followups directed to: comp.graphics.apps.gnuplot

Show all headers | View raw


Paul Li wrote:

> Thanks.  Unfortunately "%x" didn't print the correct values -- perhaps
> it's trying to format a floating point value. 

Yes, you are right. I didn't stop to check that the output was correct,
only that it did in fact print hexidecimal values.  If you call
sprintf from the gnuplot command line then the conversion to integer 
happens automatically, but apparently the mousing code does not make
that check.

> "%a" gave the correct
> values but unfortunately they were in binary scientific notation (e.g.
> 0x41 was printed as "0x1.04p+6").  I don't imagine there is any way around
> this?

I don't know of one.


If it helps any, you could use the "bind" command to attach a 
command line formatting function that does the job:

  bind h 'pause mouse; print sprintf("%x %x", MOUSE_X, MOUSE_Y)'

Now if you hit the h key while the mouse is in the plot window,
the next mouse click will print the X,Y coordinates of the click
in hex.  It doesn't give you continuous readout, but perhaps it's
good enough for your application.  

With extra work you could even have the coordinates printed to the plot 
window rather than to the console.  See the demo "mousevariables.dem".

	Ethan



> 
> On Thursday, October 25, 2012 7:57:39 PM UTC-4, sfeam wrote:
>> Paul Li wrote:
>> 
>> 
>> 
>> > Hi,
>> 
>> > 
>> 
>> > I am plotting a set of 2-D points where the Y-coordinates in hex.  Is
>> > it
>> 
>> > possible to format the current mouse position so that its Y-coordinate
>> > is
>> 
>> > displayed in hex as well?
>> 
>> 
>> 
>>   set mouse format "%x"
>> 
>> or if you want to keep x coordinates in decimal
>> 
>>   set mouse format "%g %x"
>> 
>> 
>> 
>> But not all terminal types can handle this (for example svg cannot).

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

hexadecimal mouse position? Paul Li <paulli25.li@gmail.com> - 2012-10-25 16:37 -0700
  Re: hexadecimal mouse position? sfeam <sfeam@users.sourceforge.net> - 2012-10-25 16:57 -0700
    Re: hexadecimal mouse position? Paul Li <paulli25.li@gmail.com> - 2012-10-26 09:44 -0700
      Re: hexadecimal mouse position? sfeam <sfeam@users.sourceforge.net> - 2012-10-26 11:35 -0700
        Re: hexadecimal mouse position? Paul Li <paulli25.li@gmail.com> - 2012-11-06 12:14 -0800

csiph-web