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 formatshow taller than plot unless usingfignum=0 #22972

Closed
@phil-blain

Description

@phil-blain

Bug summary

When usingplt.colorbar along withplt.matshow, the colorbar is taller than the plot. If I useplt.matshow(A, fig=0), then it is the same height as the plot.

Code for reproduction

# Basically https://matplotlib.org/stable/gallery/images_contours_and_fields/matshow.html#sphx-glr-gallery-images-contours-and-fields-matshow-py with a colorbar addedimportmatplotlib.pyplotaspltimportnumpyasnp# a 2D array with linearly increasing values on the diagonala=np.diag(range(15))plt.matshow(a)# this triggers the bug# plt.matshow(a, fignum=None) # this too# plt.matshow(a, fignum=1) # this too# plt.matshow(a, fignum=False) # this triggers the expected outcome# plt.matshow(a, fignum=0) # this tooplt.colorbar()plt.show()

Actual outcome

Figure_1

Expected outcome

Figure_2

Additional information

No response

Operating system

Ubuntu 20.04

Matplotlib Version

3.5.2

Matplotlib Backend

QtAgg

Python version

Python 3.10.4

Jupyter version

none involved

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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