Title: [Bug]: LogLocator with subs argument fragile. · Issue #24092 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: LogLocator with subs argument fragile. · Issue #24092 · matplotlib/matplotlib
X Title: [Bug]: LogLocator with subs argument fragile. · Issue #24092 · matplotlib/matplotlib
Description: Bug summary Logarithmic tick markers do not appear if the y-axis scales a sufficient range, with the subs keyword argument of ticker.LogLocator set to non-trivial values. Code for reproduction import matplotlib.pyplot as plt import matpl...
Open Graph Description: Bug summary Logarithmic tick markers do not appear if the y-axis scales a sufficient range, with the subs keyword argument of ticker.LogLocator set to non-trivial values. Code for reproduction impo...
X Description: Bug summary Logarithmic tick markers do not appear if the y-axis scales a sufficient range, with the subs keyword argument of ticker.LogLocator set to non-trivial values. Code for reproduction impo...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/24092
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: LogLocator with subs argument fragile.","articleBody":"### Bug summary\r\n\r\nLogarithmic tick markers do not appear if the y-axis scales a sufficient range, with the `subs` keyword argument of `ticker.LogLocator` set to non-trivial values.\r\n\r\n\r\n### Code for reproduction\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.ticker\r\nimport numpy as np\r\n\r\nll = matplotlib.ticker.LogLocator(subs=(1, 2, 5))\r\n\r\n### The following code produces a plot with y-axis ticks at the expected locations.\r\n\r\nfig, ax = plt.subplots()\r\nx = np.arange(8)\r\nplt.semilogy(x, 10 ** x)\r\nax.yaxis.set_major_locator(ll)\r\nax.yaxis.set_minor_locator(ll)\r\nplt.title(\"Good Plot\")\r\nplt.show()\r\n\r\n### The following code produces a plot with no y-axis ticks, which is unexpected and undesired.\r\n\r\nfig, ax = plt.subplots()\r\nx = np.arange(9) # The only change is this line\r\nplt.semilogy(x, 10 ** x)\r\nax.yaxis.set_major_locator(ll)\r\nax.yaxis.set_minor_locator(ll)\r\nplt.title(\"Bad Plot\")\r\nplt.show()\r\n\r\n### The problem is isolated to here, which returns correct values in the first case, but np.array([]) in the second case:\r\nprint(ll.tick_values(1, 1e7))\r\nprint(ll.tick_values(1, 1e8))\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n### Expected outcome\r\n\r\nI expect to see ticks in both cases, as appears in the \"Good Plot\".\r\n\r\n### Additional information\r\n\r\nThe problem is isolated to `ticker.LogLocator.tick_values()`. This returns correct values in the first case (e.g., `np.array([1.e-01 2.e-01 5.e-01 1.e+00 2.e+00 5.e+00 1.e+01 2.e+01 5.e+01 1.e+02\r\n 2.e+02 5.e+02])`), but `np.array([])` in the second case.\r\n\r\n### Operating system\r\n\r\nWindows\r\n\r\n### Matplotlib Version\r\n\r\n3.5.2\r\n\r\n### Matplotlib Backend\r\n\r\nmodule://backend_interagg\r\n\r\n### Python version\r\n\r\n3.9.13\r\n\r\n### Jupyter version\r\n\r\n_No response_\r\n\r\n### Installation\r\n\r\nconda","author":{"url":"https://github.com/peterdsharpe","@type":"Person","name":"peterdsharpe"},"datePublished":"2022-10-04T17:52:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/24092/matplotlib/issues/24092"}
| 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:1a90b7be-4349-df6c-e706-1746522c0161 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 857C:2003E5:2355982:2F0A8A0:6A520379 |
| html-safe-nonce | f199647b5971154143f55f9aaf9c9f1b29c8808c08ec94cbdb027d9bd592e70d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTdDOjIwMDNFNToyMzU1OTgyOjJGMEE4QTA6NkE1MjAzNzkiLCJ2aXNpdG9yX2lkIjoiNTgzMzc4Njg1NTExMjQ0Mjc0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8c920eb88f11351f98d5865ba86455b85152962f225163304e06c5a272abf275 |
| hovercard-subject-tag | issue:1396641313 |
| 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/24092/issue_layout |
| twitter:image | https://opengraph.githubassets.com/424412dd8aaff04c62997beda24d89271b5c89647f0bf79b0e27d7433152b092/matplotlib/matplotlib/issues/24092 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/424412dd8aaff04c62997beda24d89271b5c89647f0bf79b0e27d7433152b092/matplotlib/matplotlib/issues/24092 |
| og:image:alt | Bug summary Logarithmic tick markers do not appear if the y-axis scales a sufficient range, with the subs keyword argument of ticker.LogLocator set to non-trivial values. Code for reproduction impo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | peterdsharpe |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width