Title: [Bug]: Setting ticks on log axis behaving unexpectedly · Issue #25894 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Setting ticks on log axis behaving unexpectedly · Issue #25894 · matplotlib/matplotlib
X Title: [Bug]: Setting ticks on log axis behaving unexpectedly · Issue #25894 · matplotlib/matplotlib
Description: Bug summary The issue occurs when formatting an axis (y-axis in this example) with 'log' scale and manually setting the limits. The process of setting the major and minor tick locations then does not work as expected/ as usual. Code for ...
Open Graph Description: Bug summary The issue occurs when formatting an axis (y-axis in this example) with 'log' scale and manually setting the limits. The process of setting the major and minor tick locations then does n...
X Description: Bug summary The issue occurs when formatting an axis (y-axis in this example) with 'log' scale and manually setting the limits. The process of setting the major and minor tick locations the...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/25894
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Setting ticks on log axis behaving unexpectedly ","articleBody":"### Bug summary\r\n\r\nThe issue occurs when formatting an axis (y-axis in this example) with 'log' scale and manually setting the limits. The process of setting the major and minor tick locations then does not work as expected/ as usual.\r\n\r\n\r\n### Code for reproduction\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\n\r\nfig, ax = plt.subplots()\r\n\r\n# This section (1) fails to set the major ticks to locations [14, 18, 22, 26]\r\nax.set_yscale('log')\r\nax.set_ylim(13.5,26.5)\r\nax.set_yticks([14, 18, 22, 26])\r\n\r\n# Adding this line results in section (1) working as expected\r\nax.set_yticks([], minor=True)\r\n\r\n# Trying to also set the location of minor ticks leads to the same failure as in section (1)\r\nax.set_yticks([16, 16.5, 20, 24], minor=True)\r\n\r\n# Adding this line leads to the expected output again\r\nax.set_yticklabels([], minor=True)\r\n\r\nplt.show()\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\nDespite calling set_yticks in section (1), the actual y-ticks remain at their default location. This first part of the issue can be resolved by setting the minor tick locations to an empty list.\r\nWhen also trying to set the location of minor ticks, however, it seems that labels are automatically created for these minor ticks.\r\n\r\n\r\n### Expected outcome\r\n\r\nCalling set_yticks() should set the location of both major and minor ticks independently without the need of changing both at the same time or having to set the minor ticklabels to an empty list.\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### Operating system\r\n\r\nDebian GNU/Linux 11\r\n\r\n### Matplotlib Version\r\n\r\n3.5.1\r\n\r\n### Matplotlib Backend\r\n\r\nQtAgg\r\n\r\n### Python version\r\n\r\n3.9.2\r\n\r\n### Jupyter version\r\n\r\n_No response_\r\n\r\n### Installation\r\n\r\npip","author":{"url":"https://github.com/Spl1x","@type":"Person","name":"Spl1x"},"datePublished":"2023-05-16T08:54:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/25894/matplotlib/issues/25894"}
| 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:6664a59c-9a6b-042e-de75-7a2fc26b3466 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80F4:3FC274:5FCFBB:827B48:6A5347C2 |
| html-safe-nonce | 18276b3f41b2bb196e648cfccd667983765c4b571aa1395d28552126641f86ce |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEY0OjNGQzI3NDo1RkNGQkI6ODI3QjQ4OjZBNTM0N0MyIiwidmlzaXRvcl9pZCI6IjE3MzUzMjcwNzMyNTIzNjIxNzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2ea4126f4754846c13aa856156c338ed4d8fa466034bf8b79dd17867edae24b4 |
| hovercard-subject-tag | issue:1711564903 |
| 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/25894/issue_layout |
| twitter:image | https://opengraph.githubassets.com/12ad2d27a47d5fc9253d2bdc7cc1919dce94635df6be7f57829a85c5c321767a/matplotlib/matplotlib/issues/25894 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/12ad2d27a47d5fc9253d2bdc7cc1919dce94635df6be7f57829a85c5c321767a/matplotlib/matplotlib/issues/25894 |
| og:image:alt | Bug summary The issue occurs when formatting an axis (y-axis in this example) with 'log' scale and manually setting the limits. The process of setting the major and minor tick locations then does n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Spl1x |
| 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