Title: ENH: make default colorbar ticks adjust as nicely as axes ticks · Issue #9246 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH: make default colorbar ticks adjust as nicely as axes ticks · Issue #9246 · matplotlib/matplotlib
X Title: ENH: make default colorbar ticks adjust as nicely as axes ticks · Issue #9246 · matplotlib/matplotlib
Description: Bug report Bug summary It would be nice if the colorbars changed their number of ticks if the colorbar gets small. Code for reproduction import matplotlib import matplotlib.pyplot as plt import numpy as np X = np.random.rand(32,32)*20. f...
Open Graph Description: Bug report Bug summary It would be nice if the colorbars changed their number of ticks if the colorbar gets small. Code for reproduction import matplotlib import matplotlib.pyplot as plt import num...
X Description: Bug report Bug summary It would be nice if the colorbars changed their number of ticks if the colorbar gets small. Code for reproduction import matplotlib import matplotlib.pyplot as plt import num...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/9246
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ENH: make default colorbar ticks adjust as nicely as axes ticks","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nIt would be nice if the colorbars changed their number of ticks if the colorbar gets small. \r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required--\u003e\r\n\r\n```python\r\nimport matplotlib\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\n\r\nX = np.random.rand(32,32)*20.\r\n\r\nfig, ax = plt.subplots()\r\npc = ax.pcolormesh(X)\r\nfig.colorbar(pc)\r\n\r\nplt.show()\r\n\r\nfig, ax = plt.subplots(figsize=(4, 1.))\r\npc = ax.pcolormesh(X)\r\nfig.colorbar(pc)\r\n\r\nplt.show()\r\n\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\n**Expected outcome**\r\n\r\nThe full sized plot has 7 y-ticks and 7 colorbar ticks. Whichs is fine.\r\n\r\n\u003cimg width=\"548\" alt=\"figure_1\" src=\"https://user-images.githubusercontent.com/1562854/30940882-a3277b0e-a397-11e7-861e-f92d36f1e712.png\"\u003e\r\n\r\nIf I make the plot much smaller (as can happen if I have a bunch of subplots), then the y-axis decreases its number of ticks, but the colorbar doesn't. \r\n\r\n\u003cimg width=\"366\" alt=\"figure_1\" src=\"https://user-images.githubusercontent.com/1562854/30940890-aecc359e-a397-11e7-82eb-5ed0b3d98ea1.png\"\u003e\r\n\r\nNo idea how easy this is, and I don't think its a must-do (we can use a manual locator), but it does seem the default should be that the colorbar gets treated as well as the y-axis.\r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n* Master\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n","author":{"url":"https://github.com/jklymak","@type":"Person","name":"jklymak"},"datePublished":"2017-09-27T22:27:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/9246/matplotlib/issues/9246"}
| 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:9f30189f-a0ba-fa19-0ee3-1ab373aea051 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E4B2:607CA:392B06:509E9D:6A586A94 |
| html-safe-nonce | 7b51dbfbd64a75295594462439fcaa430ddad54b4a9c0d73897029694a74760c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEIyOjYwN0NBOjM5MkIwNjo1MDlFOUQ6NkE1ODZBOTQiLCJ2aXNpdG9yX2lkIjoiNzU2MTgxNzU4ODg5NDI5NjcyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4b16cb0363af560920632ff80cdbaed59aea46847b305d74b4e23764d5d303dc |
| hovercard-subject-tag | issue:261137495 |
| 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/9246/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bad8c50f8d82b8a9e8aa8f2df286c9cec3ec10f502a42736df9126b2926e6c00/matplotlib/matplotlib/issues/9246 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bad8c50f8d82b8a9e8aa8f2df286c9cec3ec10f502a42736df9126b2926e6c00/matplotlib/matplotlib/issues/9246 |
| og:image:alt | Bug report Bug summary It would be nice if the colorbars changed their number of ticks if the colorbar gets small. Code for reproduction import matplotlib import matplotlib.pyplot as plt import num... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jklymak |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6 |
| 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 | 8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width