imsave() and cmap

Thanks to a patch a bit while back for ListedColormap that allowed for alphas to be given, I should now be able to use imshow() and imsave() with colormaps. However, I find that the results are not correct. Particularly, the alpha values seem to be assigned incorrectly. I am still working on making a stand-alone version to demonstrate the problem, but has anyone else noticed this?

Note,

plt.imshow(d, cmap=cm)

produces an incorrect result while

plt.imshow(cm(d))

produces a correct result. However, due to a bug in imsave, I can’t do the latter as a work-around.

Thanks,
Ben Root

Sorry for being a bit cryptic yesterday, I was in a rush. I have attached a test script that demonstrates the issue.

Can anybody confirm this? I have also attached an image showing what I get (using master with TkAgg).

Thanks,
Ben Root

imshow_cmap_test.py (2.79 KB)

···

On Mon, Apr 16, 2012 at 5:10 PM, Benjamin Root <ben.root@…553…> wrote:

Thanks to a patch a bit while back for ListedColormap that allowed for alphas to be given, I should now be able to use imshow() and imsave() with colormaps. However, I find that the results are not correct. Particularly, the alpha values seem to be assigned incorrectly. I am still working on making a stand-alone version to demonstrate the problem, but has anyone else noticed this?

Note,

plt.imshow(d, cmap=cm)

produces an incorrect result while

plt.imshow(cm(d))

produces a correct result. However, due to a bug in imsave, I can’t do the latter as a work-around.

Thanks,
Ben Root