You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted to the matplotlib-devel mailing list.
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.
Particularly
plt.imshow(d, cmap=cm)
produces an incorrect result while
plt.imshow(cm(d))
produces a correct result.
Here is an example code to replicate the bug in master.
The problem is that what you want is direct indexing into the colormap, and to get that in a ScalarMappable, you need to specify the norm as a NoNorm instance. Change your first call to imshow to:
from matplotlib.colors import NoNorm
ax.imshow(d, cmap=cm, norm=NoNorm(), interpolation='none'
Originally posted to the matplotlib-devel mailing list.
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.
Particularly
produces an incorrect result while
produces a correct result.
Here is an example code to replicate the bug in master.
The text was updated successfully, but these errors were encountered: