Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: alpha array-type not working with RGB image in imshow() #26092

@patquem

Description

@patquem

Bug summary

Hi,
Whereasalpha = constant works with RGB image, this is not the case when working with anarray-type for alpha.
(In my real case, I can only pass standard imshow parameters likealphato the function of the library I use, and not a RGBA array).
Patrick

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltfromskimage.colorimportgray2rgbarr=np.random.random((10,10))arr_rgb=gray2rgb(arr)alpha=np.ones_like(arr)alpha[:5]=0.2plt.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

image

Expected outcome

image

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

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp