Title: [Bug]: matshow(..., fignum=...) broken · Issue #29540 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: matshow(..., fignum=...) broken · Issue #29540 · matplotlib/matplotlib
X Title: [Bug]: matshow(..., fignum=...) broken · Issue #29540 · matplotlib/matplotlib
Description: 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 import numpy as np import matplotlib...
Open Graph Description: 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 reproduct...
X Description: 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 reproduct...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/29540
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: matshow(..., fignum=...) broken","articleBody":"### Bug summary\n\nFrom Version 3.10.0, `plt.matshow(..., fignum=...)` is broken.\nI tested against the last nightly release matplotlib-3.11.0.dev377+g6c5e3f3348, where it is still broken.\n\n### Code for reproduction\n\n```Python\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfig = plt.figure()\nplt.matshow(np.random.random([3, 3]), fignum=fig.number)\n```\n\n### Actual outcome\n\n```\nTraceback (most recent call last):\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n File \"/home/wehandre/mambaforge/envs/temptest/lib/python3.12/site-packages/matplotlib/pyplot.py\", line 2668, in matshow\n fig = figure(fignum, figsize=figaspect(A))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/wehandre/mambaforge/envs/temptest/lib/python3.12/site-packages/matplotlib/pyplot.py\", line 1013, in figure\n if any([figsize, dpi, facecolor, edgecolor, not frameon,\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()\n```\n\n### Expected outcome\n\nNo error\n\n### Additional information\n\nThe issue is, that `figsize` is a NumPy array, and thus cannot be used within `any`. `figsize` is the result of the function [`matplotlib.figure.figaspect`](https://matplotlib.org/stable/api/figure_api.html#matplotlib.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 to `matshow` or `figaspect` inspecting their blames.\n\n### Operating system\n\n_No response_\n\n### Matplotlib Version\n\n3.10.0\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n3.12.8\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/DerWeh","@type":"Person","name":"DerWeh"},"datePublished":"2025-01-28T20:56:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/29540/matplotlib/issues/29540"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:782bcfae-5505-0ec7-6a93-5c06c897ff5c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA38:349CCC:380D83:4BACF6:6A51C050 |
| html-safe-nonce | a23ab8ef95f4ac48e8234743c240fe4a9a5d0afedaf90890d33beb9a7bb247d2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTM4OjM0OUNDQzozODBEODM6NEJBQ0Y2OjZBNTFDMDUwIiwidmlzaXRvcl9pZCI6IjE3NjExOTI1NTYwMTQ3MTQ5NjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3a71410352818ab49185099f16afc33e155a9d04c8f856ce05f2f6b0d0cb88fb |
| hovercard-subject-tag | issue:2816699975 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/29540/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be5892575dd05fa3c6a37b6ac68fbfa8b30ab01c9bfd112780133e6e47f7b55c/matplotlib/matplotlib/issues/29540 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be5892575dd05fa3c6a37b6ac68fbfa8b30ab01c9bfd112780133e6e47f7b55c/matplotlib/matplotlib/issues/29540 |
| og:image:alt | 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 reproduct... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DerWeh |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width