Title: [Bug]: colorbar axes title clobbers extend arrow · Issue #23041 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: colorbar axes title clobbers extend arrow · Issue #23041 · matplotlib/matplotlib
X Title: [Bug]: colorbar axes title clobbers extend arrow · Issue #23041 · matplotlib/matplotlib
Description: Bug summary Adding a title to a colorbar works fine in most cases, but misplaces the title text when using extend=max as argument to plt.colorbar(). Code for reproduction fig, ax = plt.subplots(figsize=(6,6)) x, y, z = [np.random.random(...
Open Graph Description: Bug summary Adding a title to a colorbar works fine in most cases, but misplaces the title text when using extend=max as argument to plt.colorbar(). Code for reproduction fig, ax = plt.subplots(fig...
X Description: Bug summary Adding a title to a colorbar works fine in most cases, but misplaces the title text when using extend=max as argument to plt.colorbar(). Code for reproduction fig, ax = plt.subplots(fig...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/23041
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: colorbar axes title clobbers extend arrow","articleBody":"### Bug summary\n\nAdding a title to a colorbar works fine in most cases, but misplaces the title text when using `extend=max` as argument to `plt.colorbar()`.\n\n### Code for reproduction\n\n```python\nfig, ax = plt.subplots(figsize=(6,6))\r\nx, y, z = [np.random.random(100) for i in range(3)]\r\n\r\nscatter = ax.scatter(x, y, c=z)\r\ncbar = plt.colorbar(scatter, extend=\"max\", ax=ax)\r\ncbar.ax.set_title(\"asdf\")\n```\n\n\n### Actual outcome\n\n\r\n\n\n### Expected outcome\n\nI would expect the title text to be above the colorbar including the arrow. This is what happens when running the above code but without `extend=\"max\"`:\r\n\r\n```python\r\nfig, ax = plt.subplots(figsize=(6,6))\r\nx, y, z = [np.random.random(100) for i in range(3)]\r\n\r\nscatter = ax.scatter(x, y, c=z)\r\ncbar = plt.colorbar(scatter, ax=ax)\r\ncbar.ax.set_title(\"asdf\")\r\n```\r\n\r\n\r\n\n\n### Additional information\n\nAesthetically, this is less of an issue with smaller figure sizes but it should generally place the text in the right place irrespective of figure dimensions.\n\n### Operating system\n\n_No response_\n\n### Matplotlib Version\n\n3.5.1\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\n_No response_","author":{"url":"https://github.com/nspies-celsiustx","@type":"Person","name":"nspies-celsiustx"},"datePublished":"2022-05-12T21:34:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/23041/matplotlib/issues/23041"}
| 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:64a33033-e8ee-d520-bca0-06e0d723c797 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F08:2A8D3D:1E265:25D45:6A52E0B7 |
| html-safe-nonce | e531ff091903627e709843ab0739068ecacab7ce47d29e6ca04b038d3acdeedf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjA4OjJBOEQzRDoxRTI2NToyNUQ0NTo2QTUyRTBCNyIsInZpc2l0b3JfaWQiOiIzNTUwOTY2MTY3Njg1NDg4ODIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e4e32c77386a2ad7e1bd84bf5e9dc4bfeab1932bf1cc7b61f8710db30f226cb8 |
| hovercard-subject-tag | issue:1234505008 |
| 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/23041/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9e53f2651124446f29f2b81d0e109ee8f4de2738d719ee63c17fbda599825eeb/matplotlib/matplotlib/issues/23041 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9e53f2651124446f29f2b81d0e109ee8f4de2738d719ee63c17fbda599825eeb/matplotlib/matplotlib/issues/23041 |
| og:image:alt | Bug summary Adding a title to a colorbar works fine in most cases, but misplaces the title text when using extend=max as argument to plt.colorbar(). Code for reproduction fig, ax = plt.subplots(fig... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nspies-celsiustx |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width