Animated Line2D

I modified the path_editor.py example in order to make a
line editor, as attached. However, the line is not animated even the line has
been correctly updated. It seems canvas.blit is not functioning correctly in
motion_notify_callback. Canvas.blit works in draw_callback because the initial
line can be plotted.

I read the Curse implement which uses lines. This
implementation uses visible but not animated property to achieve the animation.
Any reason for that?

I appreciated any suggestions to fix this problem.

** Jinsuo Nie**

line_editor.py (3.79 KB)

I modified the path_editor.py example in order to make a line editor, as
attached. However, the line is not animated even the line has been
correctly updated. It seems canvas.blit is not functioning correctly in
motion_notify_callback. Canvas.blit works in draw_callback because the
initial line can be plotted.

Unfortunately, I cannot understand your problem. I have tried running
your attached example and it seems to run fine on my system (I can
drag the vertices and the line drawing is updated). Can you describe
the problem you are seeing? Could this be a version problem -- what
version of mpl are you running?

  johnh@...2715...:Downloads> python -c 'import matplotlib; print
matplotlib.__version__'
  1.0.svn

I read the Curse implement which uses lines. This implementation uses
visible but not animated property to achieve the animation. Any reason for
that?

Do you mean matplotlib.widgets.Cursor? It does use the animated
property -- at least in the svn version. See the line in the __init__
function:

        if useblit:
            lineprops['animated'] = True

JDH

···

On Mon, Jun 7, 2010 at 10:14 AM, Nie, Jinsuo <jnie@...3141...> wrote:

John,

Thank you very much for a prompt reply.

I am using Ipython with QT4 backend for the examples. I can have animated plot (dragable vertices) for the path_editor.py, but not for the line_editor.py. My python installation is pythonxy on windows 7. Could you please tell me your installation?

Yes, I do mean the matplotlib.widgets.Cursor, and I have version of 0.99.1. My version does not have the two lines as you mentioned.

···

--
Jinsuo

-----Original Message-----
From: John Hunter [mailto:jdh2358@…287…]
Sent: Monday, June 07, 2010 12:19 PM
To: Nie, Jinsuo
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Animated Line2D

On Mon, Jun 7, 2010 at 10:14 AM, Nie, Jinsuo <jnie@...3141...> wrote:

I modified the path_editor.py example in order to make a line editor, as
attached. However, the line is not animated even the line has been
correctly updated. It seems canvas.blit is not functioning correctly in
motion_notify_callback. Canvas.blit works in draw_callback because the
initial line can be plotted.

Unfortunately, I cannot understand your problem. I have tried running
your attached example and it seems to run fine on my system (I can
drag the vertices and the line drawing is updated). Can you describe
the problem you are seeing? Could this be a version problem -- what
version of mpl are you running?

  johnh@...2715...:Downloads> python -c 'import matplotlib; print
matplotlib.__version__'
  1.0.svn

I read the Curse implement which uses lines. This implementation uses
visible but not animated property to achieve the animation. Any reason for
that?

Do you mean matplotlib.widgets.Cursor? It does use the animated
property -- at least in the svn version. See the line in the __init__
function:

        if useblit:
            lineprops['animated'] = True

JDH

John,

I just tried all backends I have on my Win7 system (Qt4Agg, WXAgg, TkAgg) and found none of them could allow the animation in the line_editor.py. Please let me know whether I have to use GTK or GTKAgg to get the animation. Thanks.

···

--
Jinsuo

-----Original Message-----
From: John Hunter [mailto:jdh2358@…287…]
Sent: Monday, June 07, 2010 12:19 PM
To: Nie, Jinsuo
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Animated Line2D

On Mon, Jun 7, 2010 at 10:14 AM, Nie, Jinsuo <jnie@...3141...> wrote:

I modified the path_editor.py example in order to make a line editor, as
attached. However, the line is not animated even the line has been
correctly updated. It seems canvas.blit is not functioning correctly in
motion_notify_callback. Canvas.blit works in draw_callback because the
initial line can be plotted.

Unfortunately, I cannot understand your problem. I have tried running
your attached example and it seems to run fine on my system (I can
drag the vertices and the line drawing is updated). Can you describe
the problem you are seeing? Could this be a version problem -- what
version of mpl are you running?

  johnh@...2715...:Downloads> python -c 'import matplotlib; print
matplotlib.__version__'
  1.0.svn

I read the Curse implement which uses lines. This implementation uses
visible but not animated property to achieve the animation. Any reason for
that?

Do you mean matplotlib.widgets.Cursor? It does use the animated
property -- at least in the svn version. See the line in the __init__
function:

        if useblit:
            lineprops['animated'] = True

JDH