Title: [Bug]: Changing limits by setting ticks does not emit "x/ylim_changed" · Issue #31247 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Changing limits by setting ticks does not emit "x/ylim_changed" · Issue #31247 · matplotlib/matplotlib
X Title: [Bug]: Changing limits by setting ticks does not emit "x/ylim_changed" · Issue #31247 · matplotlib/matplotlib
Description: Bug summary "x/ylim_changed" should be emitted whenever the limits of an axis is changed. However, when the limits are changed via as a consequence of ax.set_xticks, the signal is not emitted. Code for reproduction import matplotlib.pypl...
Open Graph Description: Bug summary "x/ylim_changed" should be emitted whenever the limits of an axis is changed. However, when the limits are changed via as a consequence of ax.set_xticks, the signal is not emitted. Code...
X Description: Bug summary "x/ylim_changed" should be emitted whenever the limits of an axis is changed. However, when the limits are changed via as a consequence of ax.set_xticks, the signal is not emi...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31247
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Changing limits by setting ticks does not emit \"x/ylim_changed\"","articleBody":"### Bug summary\n\n\"x/ylim_changed\" should be emitted whenever the limits of an axis is changed. However, when the limits are changed via as a consequence of `ax.set_xticks`, the signal is not emitted.\n\n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\n\ndef xlim_changed(ax):\n print(f'xlim changed to: {ax.get_xlim()}')\n\nfig, ax = plt.subplots()\nax.callbacks.connect(\"xlim_changed\", xlim_changed)\nax.set_xlim(0.5, 1) # emits \"xlim_changed\" as expected\nax.set_xticks([0, 100]) # does not emit \"xlim_changed\"\n```\n\n### Actual outcome\n\nxlim changed to: (np.float64(0.5), np.float64(1.0))\n\n### Expected outcome\n\nxlim changed to: (np.float64(0.5), np.float64(1.0))\nxlim changed to: (np.float64(0.0), np.float64(100.0))\n\n\n\n### Additional information\n\nI became aware of this bug while working on https://github.com/matplotlib/matplotlib/pull/31214\n\nfor reference the plot produced by the above code looks like this:\n\u003cimg width=\"560\" height=\"418\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/c7518cae-5563-4fd0-ad74-148b952f6342\" /\u003e\n\n### Operating system\n\nUbuntu\n\n### Matplotlib Version\n\n3.11.0.dev\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n3.13\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\ngit checkout","author":{"url":"https://github.com/trygvrad","@type":"Person","name":"trygvrad"},"datePublished":"2026-03-06T20:14:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/31247/matplotlib/issues/31247"}
| 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:00b9f8c8-739b-ca35-e0f4-349e5e233ea1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DC08:2FB335:A6EE5E:E0B38D:6A527EBE |
| html-safe-nonce | a687a0f43facc5861d04bdcd698b20222f50f4d76e0a328b718c4d09f97c7563 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzA4OjJGQjMzNTpBNkVFNUU6RTBCMzhEOjZBNTI3RUJFIiwidmlzaXRvcl9pZCI6IjM2NjE3MzEzNzI3OTQ1NDM4MDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8bf99d43375c176795102e9d5a7884d7a08ba1040b48f43d59ca771bfbcc48f4 |
| hovercard-subject-tag | issue:4035975220 |
| 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/31247/issue_layout |
| twitter:image | https://opengraph.githubassets.com/30fe573be87e17a721f3229ec346f6a4b76c77190c3c61ab3e48b49714f3245f/matplotlib/matplotlib/issues/31247 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/30fe573be87e17a721f3229ec346f6a4b76c77190c3c61ab3e48b49714f3245f/matplotlib/matplotlib/issues/31247 |
| og:image:alt | Bug summary "x/ylim_changed" should be emitted whenever the limits of an axis is changed. However, when the limits are changed via as a consequence of ax.set_xticks, the signal is not emitted. Code... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trygvrad |
| 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