bug in imshow for PDF, EPS output

Hi all,

I've come across an apparent bug in imshow when outputting to PDF and
EPS files. (I haven't tested other vector formats.) It manifests as
a small scaling error between the raster image and the axes
coordinates.

I have attached a test script to illustrate the problem. The
(correct) PNG output file shows a green 'X' at the common point
between four pixels near the center of the raster image. The extent
is chosen such that the coordinates refer to pixel centers. The PDF
and EPS output files show a misalignment between the X and the pixel
boundaries -- zoom in to see it clearly. Also, the topmost row and
rightmost column appear truncated.

I did some digging to see if I could figure out how the image scale
was being mangled. I had a hunch that it was due to some interaction
between fixed-72-dpi code, rounding the number of pixels, and
subsequent rescaling. However, the image scale still seems to be off
even when the dpi setting is a multiple of 72.

I am using svn r7395 on OSX 10.4.11. I previously posted to the
matplotlib-devel list, but perhaps the larger audience here can help.
Can anyone confirm this bug? I have added it to the sourceforge
tracker, ID 2832896.
https://sourceforge.net/tracker/?func=detail&aid=2832896&group_id=80706&atid=560720

Thank you for the attention,
Mike

test_image_offset.py (649 Bytes)