Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Closed
Description
Hi, not much of an issue, but it seems thatimshow is not interpolating RGBA images in the proper way. There was some discussion about a similar issue in#9906 which ended up on a documentation note:
imshow expects RGB images adopting the straight (unassociated) alpha representation.
If that's the caseimshow should still switch to associated colors (premultiply alpha) before interpolation to avoid artefacts like the one below, shouldn't it?
import matplotlib.pyplot as pltimport numpy as npfig, (axl, axr) = plt.subplots(1, 2)# full green imageimg = np.zeros((5, 5, 4))img[...,1] = np.ones((5, 5))# transparent above main diagonalimg[...,3] = np.tril(np.ones((5, 5), dtype=np.uint8))axl.imshow(img, interpolation="none")axr.imshow(img, interpolation="bilinear")plt.show()