• Old matplotlib animation now fails

    From Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?=@martin.schoon@gmail.com to comp.lang.python on Tue Oct 15 20:16:41 2024
    From Newsgroup: comp.lang.python

    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?

    TIA

    /Martin
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.lang.python on Tue Oct 15 20:29:32 2024
    From Newsgroup: comp.lang.python

    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?


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.lang.python on Tue Oct 15 22:48:14 2024
    From Newsgroup: comp.lang.python

    On 15 Oct 2024 20:16:41 GMT, Martin Schöön wrote:

    l.set_data(x0, y0)

    Near as I can tell, “l” contains a Line2D object, so the applicable set_data call is here:

    <https://matplotlib.org/stable/api/_as_gen/matplotlib.lines.Line2D.html#matplotlib.lines.Line2D.set_data>
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From MRAB@python@mrabarnett.plus.com to comp.lang.python on Wed Oct 16 00:38:01 2024
    From Newsgroup: comp.lang.python

    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?

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?=@martin.schoon@gmail.com to comp.lang.python on Wed Oct 16 08:20:10 2024
    From Newsgroup: comp.lang.python

    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
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?=@martin.schoon@gmail.com to comp.lang.python on Wed Oct 16 08:23:17 2024
    From Newsgroup: comp.lang.python

    Den 2024-10-15 skrev MRAB <python@mrabarnett.plus.com>:
    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

    <snip>

    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'


    <snip>

    """
    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?

    So it seems.

    Thanks for the quick reply.

    /Martin
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.lang.python on Wed Oct 16 10:51:18 2024
    From Newsgroup: comp.lang.python

    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


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?=@martin.schoon@gmail.com to comp.lang.python on Wed Oct 16 15:52:55 2024
    From Newsgroup: comp.lang.python

    Den 2024-10-16 skrev Stefan Ram <ram@zedat.fu-berlin.de>:
    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

    That is a use and meaning of rock I was not aware of.

    An example of what I use this Python code for (track top right): https://shorturl.at/m3ZKp
    (Youtube's compression algorithm clearly did not like this video.)

    /Martin
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From rbowman@bowman@montana.com to comp.lang.python on Wed Oct 16 21:47:08 2024
    From Newsgroup: comp.lang.python

    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.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Chris Townley@news@cct-net.co.uk to comp.lang.python on Wed Oct 16 23:30:42 2024
    From Newsgroup: comp.lang.python

    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

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.lang.python on Wed Oct 16 22:48:59 2024
    From Newsgroup: comp.lang.python

    On 16 Oct 2024 21:47:08 GMT, rbowman wrote:

    I think 'bee's knees' died out around 1931.

    Cat’s meow. Dog’s bollocks.

    Speaking of the cat’s meow, did William Randolph Hearst really intend to kill Charlie Chaplin?

    <https://www.imdb.com/title/tt0266391/>
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From rbowman@bowman@montana.com to comp.lang.python on Thu Oct 17 03:19:17 2024
    From Newsgroup: comp.lang.python

    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.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.lang.python on Thu Oct 17 05:48:42 2024
    From Newsgroup: comp.lang.python

    On 17 Oct 2024 03:19:17 GMT, rbowman wrote:

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

    What words zey choose to use eez nahn of your bee’s knees.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.lang.python on Thu Oct 17 13:50:13 2024
    From Newsgroup: comp.lang.python

    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!


    --- Synchronet 3.20a-Linux NewsLink 1.114