-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Labels
Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!Open a pull request against these issues if there are no active ones!status: confirmed bugtopic: color/alphatopic: images
Description
Bug summary
Hi,
Whereas alpha = constant
works with RGB image, this is not the case when working with an array-type
for alpha.
(In my real case, I can only pass standard imshow parameters like alpha
to the function of the library I use, and not a RGBA array).
Patrick
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
from skimage.color import gray2rgb
arr = np.random.random((10, 10))
arr_rgb = gray2rgb(arr)
alpha = np.ones_like(arr)
alpha[:5] = 0.2
plt.figure()
plt.tight_layout()
plt.subplot(121)
plt.title("Expected outcome")
plt.imshow(arr, alpha=alpha, cmap='gray')
plt.subplot(122)
plt.title("Actual outcome")
plt.imshow(arr_rgb, alpha=alpha)
plt.show()
Actual outcome
Expected outcome
Additional information
No response
Operating system
Windows
Matplotlib Version
3.7.1
Matplotlib Backend
TkAgg
Python version
Python 3.10.11
Jupyter version
No response
Installation
pip
Metadata
Metadata
Assignees
Labels
Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!Open a pull request against these issues if there are no active ones!status: confirmed bugtopic: color/alphatopic: images