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]: Colorbar extend patches do not have correct alpha #22970

Closed
@ortk95

Description

@ortk95

Bug summary

When a colorbar hasextend != 'neither', the triangles at the end of the colorbar always havealpha=1, even when the rest of the colorbar has a different alpha value.

Code for reproduction

#!/usr/bin/env python3# -*- coding: utf-8 -*-importnumpyasnpimportmatplotlib.pyplotaspltimg=np.random.rand(5,10)alpha=0.5plt.subplot(1,2,1)plt.imshow(img,alpha=alpha,cmap='RdBu')plt.colorbar(extend='both',orientation='horizontal',label='Current behaviour')# Temporary fix to manually set the alpha of the extend patches# doesn't look perfect, but is an improvement over the current behaviourplt.subplot(1,2,2)plt.imshow(img,alpha=alpha,cmap='RdBu')cb=plt.colorbar(extend='both',orientation='horizontal',label='Temporary fix')forpatchincb._extend_patches:patch.set_alpha(alpha)plt.show()

Actual outcome

image

Expected outcome

The triangles at the end of the colorbar should have the same alpha as the colorbar (i.e. roughly like the temporary fix above)

Additional information

No response

Operating system

OS/X

Matplotlib Version

3.5.2

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

Python 3.10.4

Jupyter version

No response

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp