> Looks like we have the culprit. Is this a bug or an
> undocumented feature 

I think that the current code is a bit of a hack that sometimes works and 
sometimes doesn't, depending on which backend you use.

> and is there anything I should do about it (i.e.,
> report it)?

Yes, I think so. It's not super difficult to find a solution, but it will need 
some discussion with the matplotlib developers to find the best way to fit this 
in with the existing matplotlib code.

> More importantly, do you have any idea how to fix the
> problem 

In principle, it's simple. You'll need to split up the restore_background 
function in a frontend_restore_background and a backend_restore_background 
(arbitrary names, of course). The frontend_restore_background is what the user 
uses to tell matplotlib which background should be restored where. Inside the 
event loop, the backend_restore_background uses this information to do the 
actual blitting.

> or how the event interactions with wxpython work?

I don't think it matters much, as long as the actual drawing is done from 
inside figure.draw(renderer).

> Is it even feasible to do a
> restore_canvas within the event loop

Absolutely. There is no essential difference between drawing a line or blitting 
a background. Imagine the code in figure.draw(renderer) to be something along 
the lines of

blit a background, if any
draw the lines, if any
fill shapes with color, if any
draw the text, if any
...

> or will this slow it down to the extent of being useless?

I wouldn't know why.

--Michiel.


--- On Thu, 5/7/09, Elan Pavlov <epav...@gmail.com> wrote:

> From: Elan Pavlov <epav...@gmail.com>
> Subject: Re: [Matplotlib-users] Wxpython, Matplotlib and draw_artist
> To: mjldeh...@yahoo.com
> Cc: matplotlib-users@lists.sourceforge.net
> Date: Thursday, May 7, 2009, 10:23 AM
> Hi,
> By George, I think you've got it! That does explain the
> fact that old
> lines remain since the restore_background is what should 
> remove them.
> To test out your hypotheses I added sleep commands after
> every line in
> the update_line()  function and indeed a blank axes never
> appears.
> Looks like we have the culprit. Is this a bug or an
> undocumented
> feature and is there anything I should do about it (i.e.,
> report it)?
> More importantly, do you have any idea how to fix the
> problem or how
> the event interactions with wxpython work? Is it even
> feasible to do a
> restore_canvas within the event loop or will this slow it
> down to the
> extent of being useless?
> 
> Elan
> ---
> I can no other answer make but thanks,
> And thanks, and ever thanks.
> - William Shakespeare
> 
> On Thu, May 7, 2009 at 9:17 AM, Michiel de Hoon
> <mjldeh...@yahoo.com> wrote:
> >
> > I am not sure if this is related, but maybe it can
> give you a hint.
> > I looked at the copy_from_bbox/restore/draw_artist
> code a long time ago, and if I remember correctly by calling
> restore_region function, you're drawing directly onto
> the canvas. In contrast, if you do e.g. plot(x,y),
> you're not drawing directly; you're just telling
> matplotlib what you want to plot, but the actual plotting is
> done by matplotlib by calling figure.draw(renderer).
> Typically, this happens from inside the event loop, which is
> how things are supposed to be. On the other hand,
> restore_region bypasses the event loop, which is usually not
> a good idea.
> >
> > --Michiel
> >
> >
> >
> >
> > --- On Wed, 5/6/09, Elan Pavlov
> <epav...@gmail.com> wrote:
> >
> >> From: Elan Pavlov <epav...@gmail.com>
> >> Subject: [Matplotlib-users] Wxpython, Matplotlib
> and draw_artist
> >> To: matplotlib-users@lists.sourceforge.net
> >> Date: Wednesday, May 6, 2009, 2:05 PM
> >> Hi,
> >> I can't get wxpython to play well with
> matplotlib and
> >> draw_artist.
> >> After mucking around quite a bit I think I
> narrowed it down
> >> to the
> >> draw_artist function The problem seems to be that
> >> draw_artist when
> >> working within wxpython (as opposed to a simple
> mpl window)
> >> doesn't
> >> remove the old points it plotted. I adapted the
> example
> >> from the
> >> cookbook
> >>
> (http://www.scipy.org/Cookbook/Matplotlib/Animations) to
> >> illustrate this problem. I modified the example so
> it is
> >> updated on
> >> mouse movements (followed by idle time) so that
> the problem
> >> is more
> >> visual.
> >>
> >> Replacing the copy_from_bbox/restore/draw_artist
> (i.e.
> >> removing the
> >> animated properties) with the simple draw causes
> this to
> >> work. The
> >> copy_from_bbox/restore methods work as expected so
> it seems
> >> that the
> >> problem is either the draw_artist (or possibly the
> blit,
> >> but that
> >> seems unlikely).
> >>
> >> Is there something I am doing wrong?
> >>
> >> Elan
> >> --
> >> Beware of bugs in the above code; I have only
> proved it
> >> correct, not tried it.
> >> - Donald Knuth
> >>
> ------------------------------------------------------------------------------
> >> The NEW KODAK i700 Series Scanners deliver under
> ANY
> >> circumstances! Your
> >> production scanning environment may not be a
> perfect world
> >> - but thanks to
> >> Kodak, there's a perfect scanner to get the
> job done!
> >> With the NEW KODAK i700
> >> Series Scanner you'll get full speed at 300
> dpi even
> >> with all image
> >> processing features enabled.
> >>
> http://p.sf.net/sfu/kodak-com_______________________________________________
> >> Matplotlib-users mailing list
> >> Matplotlib-users@lists.sourceforge.net
> >>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >


      

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to