display pixels values on the backends

Hi,

I have already asked about that but I'm back once again :slight_smile:

The way I use matplotlib may be a corner case:
I'm often looking at large (4k x 4k) images and I do want to see the pixels values moving the mouse over the display.
imshow does a great job but all the backend only display "x= y=".
I would love to see "x= y= Z=" (or "value="...call it the way you want ;))

What is the best way to do that?
imshow is great because there is nothing to connect to see x and y values on the backend.
I need to code something as simple as imshow to get also the pixel values.

Is there really on way to get that as a new option in imshow? at least in one of the backend (as a starting point)

Best Regards,
Xavier

Hi,

I have already asked about that but I'm back once again :slight_smile:

The way I use matplotlib may be a corner case:
I'm often looking at large (4k x 4k) images and I do want to see the
pixels values moving the mouse over the display.
imshow does a great job but all the backend only display "x= y=".
I would love to see "x= y= Z=" (or "value="...call it the way you want ;))

What is the best way to do that?
imshow is great because there is nothing to connect to see x and y
values on the backend.
I need to code something as simple as imshow to get also the pixel values.

The easiest way I can think of is to override Axes.format_coord
method. A pseudo code might look like below

def report_pixel(x, y):
   # get the pixel value
   v = get_pixel_value_of_your_image(x,y)

   return "x=%f y=%f value=%f" % (x, y, v)

ax = gca()
ax.format_coord = report_pixel

The code will become more complicated if you want to support multiple images.
This solution is far from elegant, but maybe the easiest one.

-JJ

···

On Mon, Aug 24, 2009 at 1:48 PM, Xavier Gnata<xavier.gnata@...287...> wrote:

Is there really on way to get that as a new option in imshow? at least
in one of the backend (as a starting point)

Best Regards,
Xavier

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hi,

I have already asked about that but I'm back once again :slight_smile:

The way I use matplotlib may be a corner case:
I'm often looking at large (4k x 4k) images and I do want to see the
pixels values moving the mouse over the display.
imshow does a great job but all the backend only display "x= y=".
I would love to see "x= y= Z=" (or "value="...call it the way you want ;))

What is the best way to do that?
imshow is great because there is nothing to connect to see x and y
values on the backend.
I need to code something as simple as imshow to get also the pixel values.
    
The easiest way I can think of is to override Axes.format_coord
method. A pseudo code might look like below

def report_pixel(x, y):
   # get the pixel value
   v = get_pixel_value_of_your_image(x,y)

   return "x=%f y=%f value=%f" % (x, y, v)

ax = gca()
ax.format_coord = report_pixel

The code will become more complicated if you want to support multiple images.
This solution is far from elegant, but maybe the easiest one.

-JJ

Is there really on way to get that as a new option in imshow? at least
in one of the backend (as a starting point)

Best Regards,
Xavier
    

Thanks it does work but I still wonder why it is not an option in imshow

Xavier