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]: matshow(..., fignum=...) broken #29540

Closed
@DerWeh

Description

@DerWeh

Bug summary

From Version 3.10.0,plt.matshow(..., fignum=...) is broken.
I tested against the last nightly release matplotlib-3.11.0.dev377+g6c5e3f3348, where it is still broken.

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltfig=plt.figure()plt.matshow(np.random.random([3,3]),fignum=fig.number)

Actual outcome

Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/home/wehandre/mambaforge/envs/temptest/lib/python3.12/site-packages/matplotlib/pyplot.py", line 2668, in matshow    fig = figure(fignum, figsize=figaspect(A))          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/home/wehandre/mambaforge/envs/temptest/lib/python3.12/site-packages/matplotlib/pyplot.py", line 1013, in figure    if any([figsize, dpi, facecolor, edgecolor, not frameon,       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Expected outcome

No error

Additional information

The issue is, thatfigsize is a NumPy array, and thus cannot be used withinany.figsize is the result of the functionmatplotlib.figure.figaspect. To my knowledge, previously, this returned a tuple, which can be evaluated as a boolean. The documentation still suggests that the result is a tuple. However, I don't see any changes tomatshow orfigaspect inspecting their blames.

Operating system

No response

Matplotlib Version

3.10.0

Matplotlib Backend

No response

Python version

3.12.8

Jupyter version

No response

Installation

pip

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