{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/12312","repository_url":"https://api.github.com/repos/matplotlib/matplotlib","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/12312/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/12312/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/12312/events","html_url":"https://github.com/matplotlib/matplotlib/issues/12312","id":364602089,"node_id":"MDU6SXNzdWUzNjQ2MDIwODk=","number":12312,"title":"colorbar(boundaries=...) doesn't work so well with nonlinear norms","user":{"login":"anntzer","id":1322974,"node_id":"MDQ6VXNlcjEzMjI5NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1322974?v=4","gravatar_id":"","url":"https://api.github.com/users/anntzer","html_url":"https://github.com/anntzer","followers_url":"https://api.github.com/users/anntzer/followers","following_url":"https://api.github.com/users/anntzer/following{/other_user}","gists_url":"https://api.github.com/users/anntzer/gists{/gist_id}","starred_url":"https://api.github.com/users/anntzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anntzer/subscriptions","organizations_url":"https://api.github.com/users/anntzer/orgs","repos_url":"https://api.github.com/users/anntzer/repos","events_url":"https://api.github.com/users/anntzer/events{/privacy}","received_events_url":"https://api.github.com/users/anntzer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-27T18:35:06Z","updated_at":"2018-09-27T22:42:57Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"<!--To help us understand and resolve your issue, please fill out the form to the best of your ability.-->\r\n<!--You can feel free to delete the sections that do not apply.-->\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\n<!--A short 1-2 sentences that succinctly describes the bug-->\r\n\r\n**Code for reproduction**\r\n\r\n<!--A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required-->\r\n\r\n```python\r\nfrom pylab import *\r\nimshow(np.random.rand(100, 100), norm=mpl.colors.LogNorm())\r\ncolorbar(boundaries=[1e-4, 1e-3, 1e-2, 1])\r\n```\r\n\r\n**Actual outcome**\r\n\r\n![test](https://user-images.githubusercontent.com/1322974/46166672-12bb1900-c294-11e8-977f-930538f82072.png)\r\n\r\n**Expected outcome**\r\n\r\nEither properly positioned boundaries, or (better) disallow passing boundaries in such cases.\r\n\r\nNote that the docstrings in colorbar.py say\r\n```\r\n    The following will probably be useful only in the context of\r\n    indexed colors (that is, when the mappable has norm=NoNorm()),\r\n    or other unusual circumstances.\r\n\r\n    ============   ===================================================\r\n    Property       Description\r\n    ============   ===================================================\r\n    *boundaries*   None or a sequence\r\n    *values*       None or a sequence which must be of length 1 less\r\n                   than the sequence of *boundaries*. For each region\r\n                   delimited by adjacent entries in *boundaries*, the\r\n                   color mapped to the corresponding value in values\r\n                   will be used.\r\n    ============   ===================================================\r\n```\r\nbut that still ends up part of the public API, which makes my intended fix for https://github.com/matplotlib/matplotlib/issues/7320 more difficult...\r\n\r\n**Matplotlib version**\r\n<!--Please specify your platform and versions of the relevant libraries you are using:-->\r\n  * Operating system: linux\r\n  * Matplotlib version: master\r\n  * Matplotlib backend (`print(matplotlib.get_backend())`): qt5agg\r\n  * Python version: 3.7\r\n  * Jupyter version (if applicable):\r\n  * Other libraries: \r\n\r\n<!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda-->\r\n<!--If you installed from conda, please specify which channel you used if not the default-->\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/425265511","html_url":"https://github.com/matplotlib/matplotlib/issues/12312#issuecomment-425265511","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/12312","id":425265511,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTI2NTUxMQ==","user":{"login":"ImportanceOfBeingErnest","id":23121882,"node_id":"MDQ6VXNlcjIzMTIxODgy","avatar_url":"https://avatars2.githubusercontent.com/u/23121882?v=4","gravatar_id":"","url":"https://api.github.com/users/ImportanceOfBeingErnest","html_url":"https://github.com/ImportanceOfBeingErnest","followers_url":"https://api.github.com/users/ImportanceOfBeingErnest/followers","following_url":"https://api.github.com/users/ImportanceOfBeingErnest/following{/other_user}","gists_url":"https://api.github.com/users/ImportanceOfBeingErnest/gists{/gist_id}","starred_url":"https://api.github.com/users/ImportanceOfBeingErnest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ImportanceOfBeingErnest/subscriptions","organizations_url":"https://api.github.com/users/ImportanceOfBeingErnest/orgs","repos_url":"https://api.github.com/users/ImportanceOfBeingErnest/repos","events_url":"https://api.github.com/users/ImportanceOfBeingErnest/events{/privacy}","received_events_url":"https://api.github.com/users/ImportanceOfBeingErnest/received_events","type":"User","site_admin":false},"created_at":"2018-09-27T22:42:57Z","updated_at":"2018-09-27T22:42:57Z","author_association":"CONTRIBUTOR","body":"I would have though the \"usual\" (if you can speak of \"usual\" for something that declared \"unusual\") use case would be something like\r\n\r\n```\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.colors\r\nimport numpy as np; np.random.seed(42)\r\n\r\ndata = np.random.choice([0,5,250], size=(12,12))\r\ncmap = matplotlib.colors.ListedColormap([\"crimson\",\"gold\",\"indigo\"])\r\nbounds = [0,1,10,1000]\r\nnorm = matplotlib.colors.BoundaryNorm(bounds, len(bounds)-1)\r\n\r\nfig, axes = plt.subplots(ncols=2)\r\n\r\nfor ax, spacing in zip(axes, [\"uniform\", \"proportional\"]):\r\n\r\n    ax.set_title(\"spacing=\"+spacing)\r\n    im = ax.imshow(data, norm=norm, cmap=cmap)\r\n    fig.colorbar(im, ax=ax, boundaries=bounds, values =[0,5,250], spacing=spacing, \r\n                 orientation=\"horizontal\")\r\n\r\nplt.show()\r\n```\r\n\r\n![image](https://user-images.githubusercontent.com/23121882/46178467-43f91080-c2b7-11e8-84e5-bc7fe09f201b.png)\r\n\r\nHere the use of `\"proportional\"` is clearly undesired.\r\n\r\nThe consequence of such change is then the usual \"My plot looks different, what can I do?\". Hence my vote here would be: Don't break the API. "}}
{"actor":{"display_login":"ImportanceOfBeingErnest"}}