Old matplotlib animation now fails

MRAB python at mrabarnett.plus.com
Tue Oct 15 19:38:01 EDT 2024


On 2024-10-15 21:16, Martin Schöön via Python-list wrote:
> Some years ago I created a Python program that reads GPS data and
> creates an animation stored in an mp4 file. Not very elegant but it
> worked. Not very original as it was based on the example found here:
> 
> https://shorturl.at/dTCZZ
> 
> Last time it worked was about a year ago. Since then I have moved to a
> later version of Debian and Conda and as a consequence a later version
> of Python 3 (now 3.12.2).
> 
> Now my code fails. I have downloaded the latest version of the example
> and it also fails.
> 
> It is the second to last line that throws an error:
> 
> l.set_data(x0, y0)
> 
> The error messages drills down to something called
> "/home/.../matplotlib/lines.py", line 1289, in set_xdata
> 
> and tells me 'x must be a sequence'
> 
> I have started to dig around in matplotlib's documentation but my
> strategy is clearly wanting. I don't really know where to start
> looking for information on how to correct my code. Hence, this
> call for help.
> 
> Any ideas?
>
This is from the help:

"""
Help on function set_data in module matplotlib.lines:

set_data(self, *args)
     Set the x and y data.

     Parameters
     ----------
     *args : (2, N) array or two 1D arrays

     See Also
     --------
     set_xdata
     set_ydata
"""

So, the arguments should be arrays:

For example:

     x0, y0 = np.array([0.0]), np.array([0.0])

Has the API changed at some point?



More information about the Python-list mailing list