[Matplotlib-users] Pixel numbers should be formated as integers

2008-08-30 Thread Xavier Gnata
Hi,

I'm using the TkAgg backend. It is nice and fine except one issue:

Here is a trivial testcase:

import pylab
import numpy

M=numpy.zeros((2000,2000))
pylab.imshow(M)

The cursor position is displayed this way: x=1.23e03 y=1.72e03 (in right 
corner of the window)
It should be formated as intergers and not as floats.

It is not only cosmetics because with 1.23e03, we are missing the last 
digit (it matters in my usecase and anyhow it is q bit stupid).

The fix should be trivial but I have to find the line of interest...

Xavier

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Pixel numbers should be formated as integers

2008-08-30 Thread John Hunter
On Sat, Aug 30, 2008 at 4:13 PM, Xavier Gnata <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm using the TkAgg backend. It is nice and fine except one issue:
>
> Here is a trivial testcase:
>
> import pylab
> import numpy
>
> M=numpy.zeros((2000,2000))
> pylab.imshow(M)
>
> The cursor position is displayed this way: x=1.23e03 y=1.72e03 (in right
> corner of the window)
> It should be formated as intergers and not as floats.
>
> It is not only cosmetics because with 1.23e03, we are missing the last
> digit (it matters in my usecase and anyhow it is q bit stupid).
>
> The fix should be trivial but I have to find the line of interest...

The x and y toolbar coordinate formatting are controlled by a pair of
functions, fmt_xdata and fmt_ydata.  You can set them to be anything
you like, eg for integer formatting:

def format_int(x):
return '%d'%int(x)

ax.fmt_xdata = format_int


JDH

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users