Title: [ENH]: Colorbar should support location kwarg that sets both orientation and ticklocation · Issue #22676 · matplotlib/matplotlib · GitHub
Open Graph Title: [ENH]: Colorbar should support location kwarg that sets both orientation and ticklocation · Issue #22676 · matplotlib/matplotlib
X Title: [ENH]: Colorbar should support location kwarg that sets both orientation and ticklocation · Issue #22676 · matplotlib/matplotlib
Description: Problem When colorbar autocreates an Axes, one can pass location, which also sets the colorbar's orientation and the ticklocation (left for a left colorbar, right for a right colorbar, etc.). When one instead passes a manually created Ax...
Open Graph Description: Problem When colorbar autocreates an Axes, one can pass location, which also sets the colorbar's orientation and the ticklocation (left for a left colorbar, right for a right colorbar, etc.). When ...
X Description: Problem When colorbar autocreates an Axes, one can pass location, which also sets the colorbar's orientation and the ticklocation (left for a left colorbar, right for a right colorbar, etc.). W...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/22676
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[ENH]: Colorbar should support location kwarg that sets both orientation and ticklocation","articleBody":"### Problem\n\nWhen colorbar autocreates an Axes, one can pass `location`, which also sets the colorbar's orientation and the ticklocation (left for a left colorbar, right for a right colorbar, etc.). When one instead passes a manually created Axes (e.g. using inset_axes, as suggested by the colorbar_placement.py example), the `location` kwarg is not accepted (because things are directly passed to the Colorbar class); one needs to explicitly set `orientation` and `ticklocation` (the latter is not even documented by `Figure.colorbar`):\r\n```python\r\nfrom pylab import *\r\nsfs = figure(layout=\"constrained\").subfigures(1, 2)\r\nax = sfs[0].add_subplot()\r\nim = ax.imshow([[0, 1], [2, 3]])\r\nax.figure.colorbar(im, location=\"top\")\r\nax = sfs[1].add_subplot()\r\nim = ax.imshow([[0, 1], [2, 3]])\r\nax.figure.colorbar(im, cax=ax.inset_axes([0, 1.05, 1, 0.05]),\r\n orientation=\"horizontal\", ticklocation=\"top\")\r\nshow()\r\n```\n\n### Proposed solution\n\nAdd a `location` kwarg to the Colorbar constructor which sets both `orientation` and `ticklocation`, and is mutually exclusive with them.\r\n... or at least better document the workaround.","author":{"url":"https://github.com/anntzer","@type":"Person","name":"anntzer"},"datePublished":"2022-03-20T14:04:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/22676/matplotlib/issues/22676"}
| 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:2447b6d3-d496-637d-8b89-1cfb20947b25 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D46C:1B675D:9E6E61:D39BC2:6A531480 |
| html-safe-nonce | d8367b1c2057ecdaa6fbbc12eaa2f63126b696d422782d801a5c4fb60621482e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDZDOjFCNjc1RDo5RTZFNjE6RDM5QkMyOjZBNTMxNDgwIiwidmlzaXRvcl9pZCI6IjQ0NzAxNjMzMjE2Mzk4Njc1MjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4c81e33b48f15be672255090dd541930115c9b0f99635e5024890892479ec1ac |
| hovercard-subject-tag | issue:1174559609 |
| 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/22676/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ba321aee6ee6a1dc9fd39bc12c600a695ea719992b7b933ff5c307757d3ee760/matplotlib/matplotlib/issues/22676 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ba321aee6ee6a1dc9fd39bc12c600a695ea719992b7b933ff5c307757d3ee760/matplotlib/matplotlib/issues/22676 |
| og:image:alt | Problem When colorbar autocreates an Axes, one can pass location, which also sets the colorbar's orientation and the ticklocation (left for a left colorbar, right for a right colorbar, etc.). When ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anntzer |
| 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