• Re: Old matplotlib animation now fails

    From Stefan Ram@21:1/5 to martin.schoon@gmail.com on Tue Oct 15 20:29:32 2024
    Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= <martin.schoon@gmail.com> wrote or quoted: >l.set_data(x0, y0)

    Well, I got to say, it's pretty rad that you're rocking Python!
    That language is the bee's knees, for real.

    As for your question, here's my two cents off the cuff:
    Could it be that the newer Matplotlib versions are jonesing
    for something like "l.set_data( [ x0 ],[ y0 ])" in that spot?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From MRAB@21:1/5 to All on Wed Oct 16 00:38:01 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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to martin.schoon@gmail.com on Wed Oct 16 10:51:18 2024
    Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= <martin.schoon@gmail.com> wrote or quoted: >Me rocking Python?

    |to rock
    |1. To use. To make do with, usually to great effect.
    |"You don't need to make up the guest bed; we can rock the couch."
    Urban Dictionary (2005) - Aaron Peckham (editor) (1979-04-03/),
    Andrews McMeel Publishing, Kansas City

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbowman@21:1/5 to All on Wed Oct 16 21:47:08 2024
    On 16 Oct 2024 08:20:10 GMT, Martin Schöön wrote:

    Den 2024-10-15 skrev Stefan Ram <ram@zedat.fu-berlin.de>:
    Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= <martin.schoon@gmail.com> wrote or
    quoted:
    l.set_data(x0, y0)

    Well, I got to say, it's pretty rad that you're rocking Python!
    That language is the bee's knees, for real.

    As for your question, here's my two cents off the cuff:
    Could it be that the newer Matplotlib versions are jonesing for
    something like "l.set_data( [ x0 ],[ y0 ])" in that spot?

    Thanks, that was quick and adding square brackets fixed my code.

    Me rocking Python?

    /Martin

    You have to understand Stefan tries to use American slang, not always
    entirely accurately. I think 'bee's knees' died out around 1931.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Townley@21:1/5 to rbowman on Wed Oct 16 23:30:42 2024
    On 16/10/2024 22:47, rbowman wrote:
    On 16 Oct 2024 08:20:10 GMT, Martin Schöön wrote:

    Den 2024-10-15 skrev Stefan Ram <ram@zedat.fu-berlin.de>:
    Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= <martin.schoon@gmail.com> wrote or
    quoted:
    l.set_data(x0, y0)

    Well, I got to say, it's pretty rad that you're rocking Python!
    That language is the bee's knees, for real.

    As for your question, here's my two cents off the cuff:
    Could it be that the newer Matplotlib versions are jonesing for
    something like "l.set_data( [ x0 ],[ y0 ])" in that spot?

    Thanks, that was quick and adding square brackets fixed my code.

    Me rocking Python?

    /Martin

    You have to understand Stefan tries to use American slang, not always entirely accurately. I think 'bee's knees' died out around 1931.


    Not sure about America, but the bee's knees is still in common use in the UK

    --
    Chris

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbowman@21:1/5 to Chris Townley on Thu Oct 17 03:19:17 2024
    On Wed, 16 Oct 2024 23:30:42 +0100, Chris Townley wrote:

    Not sure about America, but the bee's knees is still in common use in
    the UK

    https://en.wikipedia.org/wiki/Bee's_knees

    That version? A local bakery makes a honey flavored pastry they call
    'bee's knees' but using it in a conversation would be campy.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to rbowman on Thu Oct 17 13:50:13 2024
    rbowman <bowman@montana.com> wrote or quoted:
    You have to understand Stefan tries to use American slang, not always >entirely accurately. I think 'bee's knees' died out around 1931.

    There's some wild connections between Python and slang.
    In the streets, folks might drop a "That's bonkers as f!",
    and wouldn't ya know it, Python's rockin' the same vibe:

    with open( "data", "rb" )as f:

    . I'd wager that when you open a file "as f", it's probably packing
    more of a punch or running like a cheetah on Red Bull or something!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)