Title: [Bug]: aspect ratio control of colorbar Axes fails. · Issue #22087 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: aspect ratio control of colorbar Axes fails. · Issue #22087 · matplotlib/matplotlib
X Title: [Bug]: aspect ratio control of colorbar Axes fails. · Issue #22087 · matplotlib/matplotlib
Description: Bug summary Previously, a colorbar axes could be created with a specified aspect ratio and adjustable "box". Now it leaves whitespace either at the ends or on the sides. Code for reproduction import numpy as np import matplotlib.pyplot a...
Open Graph Description: Bug summary Previously, a colorbar axes could be created with a specified aspect ratio and adjustable "box". Now it leaves whitespace either at the ends or on the sides. Code for reproduction impor...
X Description: Bug summary Previously, a colorbar axes could be created with a specified aspect ratio and adjustable "box". Now it leaves whitespace either at the ends or on the sides. Code for reproduc...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/22087
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: aspect ratio control of colorbar Axes fails.","articleBody":"### Bug summary\n\nPreviously, a colorbar axes could be created with a specified aspect ratio and adjustable \"box\". Now it leaves whitespace either at the ends or on the sides.\n\n### Code for reproduction\n\n```python\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.colorbar as mcolorbar\r\n\r\nfig, axs = plt.subplots(ncols=3, sharey=True)\r\nfor ax, aspect in zip(axs, (20, 40, None)):\r\n cs = ax.contourf(np.arange(24).reshape((4, 6)), levels=[2, 4, 8, 16], extend=\"both\")\r\n cax, kw = mcolorbar.make_axes(ax)\r\n if aspect is not None:\r\n cax.set_aspect(aspect, anchor=(0.8, 0.5), adjustable='box')\r\n ax.set_title(f\"Cbar aspect is {aspect}\")\r\n else:\r\n ax.set_title(\"No cbar aspect\")\r\n cbar = fig.colorbar(cs, cax=cax)\r\n print(cax.get_aspect(), cax.get_adjustable())\r\nfig.savefig(\"colorbar_aspect.png\")\n```\n\n\n### Actual outcome\n\n\r\n\n\n### Expected outcome\n\nE.g., using mpl 3.4.3:\r\n\r\n\n\n### Additional information\n\nThe result is even worse with 3.5.0: the first 2 colorbars in the example are blank except for the triangles.\r\n\n\n### Operating system\n\nOS/X\n\n### Matplotlib Version\n\n3.5.1\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n3.7.12\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nconda","author":{"url":"https://github.com/efiring","@type":"Person","name":"efiring"},"datePublished":"2022-01-03T07:02:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/22087/matplotlib/issues/22087"}
| 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:5d0238eb-d156-b511-6179-20f9201375b1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ABCC:80AF9:CD9B99:113C885:6A5169CD |
| html-safe-nonce | 58584252916433b71b62209150b017c9b4140b5d05faa7b389e6eaefd9907c68 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQkNDOjgwQUY5OkNEOUI5OToxMTNDODg1OjZBNTE2OUNEIiwidmlzaXRvcl9pZCI6Ijc1NjQxMTU4MTczMDM5OTI3ODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cef73c2411a52f49749b547edbc0e8658b5e869a20f9780d4b4be3050f81d15c |
| hovercard-subject-tag | issue:1092270777 |
| 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/22087/issue_layout |
| twitter:image | https://opengraph.githubassets.com/42268cfc12c6da6e173e13f6b5c8b7dd7cd32fcf074263a5d618541e2a9462ad/matplotlib/matplotlib/issues/22087 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/42268cfc12c6da6e173e13f6b5c8b7dd7cd32fcf074263a5d618541e2a9462ad/matplotlib/matplotlib/issues/22087 |
| og:image:alt | Bug summary Previously, a colorbar axes could be created with a specified aspect ratio and adjustable "box". Now it leaves whitespace either at the ends or on the sides. Code for reproduction impor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | efiring |
| 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 | 60eaaf6d4dbaa817031b556aebd8a0a7eeb81b97 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width