Title: [Bug]: get_tick_params on xaxis shows wrong keywords · Issue #27416 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: get_tick_params on xaxis shows wrong keywords · Issue #27416 · matplotlib/matplotlib
X Title: [Bug]: get_tick_params on xaxis shows wrong keywords · Issue #27416 · matplotlib/matplotlib
Description: Bug summary get_tick_params on xaxis shows yaxis keywords Code for reproduction import matplotlib.pyplot as plt fig, ax = plt.subplots() print(ax.xaxis.get_tick_params()) Actual outcome {'left': True, 'right': False, 'labelleft': True, '...
Open Graph Description: Bug summary get_tick_params on xaxis shows yaxis keywords Code for reproduction import matplotlib.pyplot as plt fig, ax = plt.subplots() print(ax.xaxis.get_tick_params()) Actual outcome {'left': Tr...
X Description: Bug summary get_tick_params on xaxis shows yaxis keywords Code for reproduction import matplotlib.pyplot as plt fig, ax = plt.subplots() print(ax.xaxis.get_tick_params()) Actual outcome {'left&...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/27416
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: get_tick_params on xaxis shows wrong keywords","articleBody":"### Bug summary\n\n`get_tick_params` on xaxis shows yaxis keywords\n\n### Code for reproduction\n\n```python\nimport matplotlib.pyplot as plt\r\n\r\nfig, ax = plt.subplots()\r\n\r\nprint(ax.xaxis.get_tick_params())\n```\n\n\n### Actual outcome\n\n{'left': True, 'right': False, 'labelleft': True, 'labelright': False, 'gridOn': False}\n\n### Expected outcome\n\n{'bottom': True, 'top': False, 'labelbottom': True, 'labeltop': False, 'gridOn': False}\n\n### Additional information\n\nThe current implementation of `get_tick_params` tries to invert the [`keymap`](https://github.com/matplotlib/matplotlib/blob/eb02b108ea181930ab37717c75e07ba792e01f1d/lib/matplotlib/axis.py#L1071-L1084) dict which is impossible because this dict is a 1:n relationship (multiple keys with the same value). \r\nThis went unnoticed because the [test_axis_get_tick_params](https://github.com/matplotlib/matplotlib/blob/379989e9529b9c98dc866a338b272beedf1f697a/lib/matplotlib/tests/test_axes.py#L6794) didn't actually test anything: the expected value is _calculated_ in the test using the very same algorithm as the function under test.\n\n### Operating system\n\n_No response_\n\n### Matplotlib Version\n\n3.8.2\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nNone","author":{"url":"https://github.com/StefRe","@type":"Person","name":"StefRe"},"datePublished":"2023-12-01T12:48:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/27416/matplotlib/issues/27416"}
| 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:13672928-039a-af81-9f61-5c4c32208639 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A9BC:349CCC:1BE8CAB:2604A7A:6A524B3A |
| html-safe-nonce | 31357602624e4c49f9b7ee0e572511fb676de60f2e2405fd915345df50c4a048 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOUJDOjM0OUNDQzoxQkU4Q0FCOjI2MDRBN0E6NkE1MjRCM0EiLCJ2aXNpdG9yX2lkIjoiMjM2MDM3MzcwMjQ5Mzg4MzE5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3dddeef4ea3ecef8f780ba1ee2252ba1ea4136879ae1c8d0a2902230d1249f5b |
| hovercard-subject-tag | issue:2020820267 |
| 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/27416/issue_layout |
| twitter:image | https://opengraph.githubassets.com/71f2a0acf0517a14e395479a1a3c13f5af72653ce28351b6645e3047222ff90e/matplotlib/matplotlib/issues/27416 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/71f2a0acf0517a14e395479a1a3c13f5af72653ce28351b6645e3047222ff90e/matplotlib/matplotlib/issues/27416 |
| og:image:alt | Bug summary get_tick_params on xaxis shows yaxis keywords Code for reproduction import matplotlib.pyplot as plt fig, ax = plt.subplots() print(ax.xaxis.get_tick_params()) Actual outcome {'left': Tr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | StefRe |
| 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 | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width