-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Description
Bug report
Bug summary
Cannot call .set_data() to update a line with a different number of points.
import matplotlib.pyplot as plt
plt.ion()
[line] = plt.plot([1.0, 2.0], [3.0, 4.0])
line.set_data([1.0, 2.0, 3.0], [3.0, 4.0, 5.0]) # <-- error!Actual outcome
Traceback (most recent call last):
File "/tmp/foo.py", line 5, in <module>
line.set_data([1.0, 2.0, 3.0], [3.0, 4.0, 5.0])
File "/usr/lib/python3.6/site-packages/matplotlib/lines.py", line 642, in set_data
self.set_xdata(x)
File "/usr/lib/python3.6/site-packages/matplotlib/lines.py", line 1222, in set_xdata
self.stale = True
File "/usr/lib/python3.6/site-packages/matplotlib/artist.py", line 279, in stale
self.stale_callback(self, val)
File "/usr/lib/python3.6/site-packages/matplotlib/artist.py", line 76, in _stale_axes_callback
self.axes.stale = val
File "/usr/lib/python3.6/site-packages/matplotlib/artist.py", line 279, in stale
self.stale_callback(self, val)
File "/usr/lib/python3.6/site-packages/matplotlib/figure.py", line 56, in _stale_figure_callback
self.figure.stale = val
File "/usr/lib/python3.6/site-packages/matplotlib/artist.py", line 279, in stale
self.stale_callback(self, val)
File "/usr/lib/python3.6/site-packages/matplotlib/pyplot.py", line 588, in _auto_draw_if_interactive
fig.canvas.draw_idle()
File "/usr/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 1993, in draw_idle
self.draw(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py", line 467, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python3.6/site-packages/matplotlib/artist.py", line 68, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/matplotlib/figure.py", line 1248, in draw
renderer, self, artists, self.suppressComposite)
File "/usr/lib/python3.6/site-packages/matplotlib/image.py", line 139, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/lib/python3.6/site-packages/matplotlib/artist.py", line 68, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 2402, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "/usr/lib/python3.6/site-packages/matplotlib/image.py", line 139, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/lib/python3.6/site-packages/matplotlib/artist.py", line 68, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3.6/site-packages/matplotlib/lines.py", line 757, in draw
self.recache()
File "/usr/lib/python3.6/site-packages/matplotlib/lines.py", line 674, in recache
raise RuntimeError('xdata and ydata must be the same length')
RuntimeError: xdata and ydata must be the same length
Expected outcome
This used to work just fine in Matplotlib-2.0.0 (stable). Nope it didn’t work on 2.0.0 (stable) either.
Matplotlib version
- Operating System: Arch Linux
- Matplotlib Version: 2.0.0+4136.g791b28149.dirty
- Python Version: 3.6.0
Python was installed from extra/python through Pacman. Matplotlib was installed from aur/python-matplotlib-git, which sources directly from GitHub with minimal modifications.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels