Hi!

I believe I've found a bug in matplotlib which manifests after imshow(img, aspect='auto') when only a small portion of the image is displayed, e.g: when (xmax-xmin) << img.shape[1]. The effect of the bug is that the transparency for the entire image seems to vary, seemingly as a periodic funtion of (xmax-xmin). Explicitly setting the alpha channel for each pixel has no effect.

The attached script generates a random image of a certain size, and plots it in four different subplots. The only thing that differs between the subplots are slight variations in x_max. The four subplots are labeled:

1) The background image is visible.
2) The background image is not visible!
3) The background image is faded!
4) The background image is again visible!

which reflects the actual result on my system. As the subplots are scaled (for example by resizing the window), the intensity then varies in a periodic manner in each of the subplots.

The expected result is of course that the background should be fully visible in all subplots.

Additional details:

$ python test.py --verbose-helpful
matplotlib data path /usr/lib/python2.4/site-packages/matplotlib/mpl-data
$HOME=/home/bioinfo/yohell
CONFIGDIR=/home/bioinfo/yohell/.matplotlib
loaded rc file /usr/lib/python2.4/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 0.87.7
verbose.level helpful
interactive is False
platform is linux2
numerix numpy 1.0
font search path ['/usr/lib/python2.4/site-packages/matplotlib/mpl-data']
loaded ttfcache file /home/bioinfo/yohell/.matplotlib/ttffont.cache
backend WXAgg version 2.6.1.2pre

In this example I used the WXAgg backend, but GTKAgg shows the same results. I've also reproduced this bug on a WinXP machine.

Thanks for an excellent plotting package!
/Joel Hedlund
Linköping University
import numpy, pylab
image = numpy.random.randint(0, 255, 309 * 1230 * 3)
image.shape = (309, 1230, 3)
pylab.subplot(221)
pylab.text(72.5, 200, 'The background image\nis visible.')
pylab.imshow(image, aspect='auto')
pylab.axis((72, 75, 0, 309))
pylab.subplot(222)
pylab.imshow(image, aspect='auto')
pylab.text(72.5, 200, 'The background image\nis not visible!')
pylab.axis((72, 76, 0, 309))
pylab.subplot(223)
pylab.imshow(image, aspect='auto')
pylab.text(72.5, 200, 'The background image\nis faded!')
pylab.axis((72, 77, 0, 309))
pylab.subplot(224)
pylab.imshow(image, aspect='auto')
pylab.text(72.5, 200, 'The background image\nis again visible!')
pylab.axis((72, 78, 0, 309))
pylab.show()
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to