different behaviour in Windows and Linux

I'm wondering whether someone can reproduce the following problem I'm seeing in Ubuntu Intrepid.

I often use matplotlib to save images created with imshow to take advantage of matplotlib's colour maps. I've noticed that the behaviour is different for 0.98.3 between Windows XP-32 and Ubuntu Intrepid. I don't remember seeing this problem with earlier versions. This minimal example demonstrates the problem:

···

--

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm

px = 3
rcFig = {'figsize': (1, 1),
          'dpi': px,
          'subplot.bottom': 0,
          'subplot.left': 0,
          'subplot.right': 1,
          'subplot.top': 1,
          }
plt.rc('figure', **rcFig)

a = np.ones((px, px))
plt.axis('off')
plt.imshow(a, cmap=cm.gray)
plt.savefig('mpl_out.png', dpi=px)

--

In Windows I get the correct behaviour - in this case a 3x3 image with all black pixels:

bbb

However, in Linux the leftmost column of pixels is white

wbb

By the way, I think an imsave function that just saved an array as an image with a specified colourmap and clims would be a nice addition to matplotlib.image. Is there another way to achieve the same 1-to-1 array element-to-pixel image saving applying colourmaps and clims?

thanks,
Gary R.

I just realised that the example I gave may not be the best since it's not obvious what the autoscaling will do when all array values are equal. Nevertheless, even when the array contains a range of values and I use a greyscale colourmap, I'm seeing the leftmost pixel column set to all white when the array values in that column are all zeros and the image is written in Linux, whereas it's black when written in Windows.

Gary