Title: [Bug]: ax.relim() ignores scatter artist · Issue #30859 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: ax.relim() ignores scatter artist · Issue #30859 · matplotlib/matplotlib
X Title: [Bug]: ax.relim() ignores scatter artist · Issue #30859 · matplotlib/matplotlib
Description: Bug summary ax.relim() completely ignores changes to scatterplots with .set_offsets(). Code for reproduction import tkinter as tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk from matplotlib.figur...
Open Graph Description: Bug summary ax.relim() completely ignores changes to scatterplots with .set_offsets(). Code for reproduction import tkinter as tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, Na...
X Description: Bug summary ax.relim() completely ignores changes to scatterplots with .set_offsets(). Code for reproduction import tkinter as tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, Na...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/30859
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: ax.relim() ignores scatter artist","articleBody":"### Bug summary\n\n**ax.relim()** completely ignores changes to scatterplots with **.set_offsets()**.\n\n### Code for reproduction\n\n```Python\nimport tkinter as tk\nfrom matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk\nfrom matplotlib.figure import Figure\nimport numpy as np\n\nclass App:\n def __init__(self, root):\n self.root = root\n fig = Figure(figsize=(5, 5), dpi=100)\n self.ax = fig.add_subplot(111)\n\n self.canvas = FigureCanvasTkAgg(fig, root)\n self.canvas.get_tk_widget().pack(fill=\"both\", expand=True)\n\n self.toolbar = NavigationToolbar2Tk(self.canvas, root)\n\n # Create artists once\n self.scatter = self.ax.scatter([], [])\n self.line, = self.ax.plot([], [])\n\n root.after(1000, self.update_plot)\n\n def update_plot(self):\n # New data every update\n xs = np.linspace(0, 10, 100)\n ys = np.sin(xs) + np.random.normal(scale=0.1, size=100)\n\n # Update artists\n self.scatter.set_offsets(np.column_stack((xs, ys)))\n #self.line.set_data(xs, ys) #Uncomment this to see the expected behaviour\n\n # Autoscale (not working)\n self.ax.relim()\n self.ax.autoscale_view()\n\n self.canvas.draw_idle()\n\n # Keep updating\n self.root.after(1000, self.update_plot)\n\nroot = tk.Tk()\nApp(root)\nroot.mainloop()\n```\n\n### Actual outcome\n\n\u003cimg width=\"502\" height=\"574\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/320471a2-82d4-4263-aaa8-913feaf154e7\" /\u003e\n\n### Expected outcome\n\n\u003cimg width=\"502\" height=\"574\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/9e3c9f7f-0506-4725-94d7-31baa68088ae\" /\u003e\n\n### Additional information\n\n_No response_\n\n### Operating system\n\nWindows\n\n### Matplotlib Version\n\n3.9.1\n\n### Matplotlib Backend\n\ntkAgg\n\n### Python version\n\n3.11.9\n\n### Jupyter version\n\nNone\n\n### Installation\n\npip","author":{"url":"https://github.com/CyfralCoot","@type":"Person","name":"CyfralCoot"},"datePublished":"2025-12-15T05:40:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/30859/matplotlib/issues/30859"}
| 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:1f220a70-635c-5bb4-5430-3d5c232a8f29 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9AD4:37F405:83FD80:B042A3:6A52AA98 |
| html-safe-nonce | 6a53f894cdcfb12ef7d257729385f311d474d8280f2e3041e781a364f36d3b50 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QUQ0OjM3RjQwNTo4M0ZEODA6QjA0MkEzOjZBNTJBQTk4IiwidmlzaXRvcl9pZCI6IjE3NzgyOTUzMzQ4MzA3NzkwMzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d53b841698a5cb2247ae7f344725525ce8f8581cad8213668ea5e03ac5a08809 |
| hovercard-subject-tag | issue:3728809572 |
| 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/30859/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8fde32b0132b305ba3f1c6bb2d3aa22d25233a4ba25a66cdaa1f4d6037e5a787/matplotlib/matplotlib/issues/30859 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8fde32b0132b305ba3f1c6bb2d3aa22d25233a4ba25a66cdaa1f4d6037e5a787/matplotlib/matplotlib/issues/30859 |
| og:image:alt | Bug summary ax.relim() completely ignores changes to scatterplots with .set_offsets(). Code for reproduction import tkinter as tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, Na... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CyfralCoot |
| 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