Little issue with blitting technique

Hello,

I’ve just discovered blitting
technique to improve performances.

I’m using this example http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4.html

I encounter an issue if instead of using
subplot I use add_axes method to hand define where I want my plot.

In this case blitting is no more working
like if restore_region was not restoring context…

def init(self):

FigureCanvas.init(self,
Figure())

#self.ax =
self.figure.add_subplot(111)

self.ax =
self.figure.add_axes([0.1,0.1,0.8,0.2])

Any idea why in this case the example given
is not working?

Cheers,

Laurent

I haven't tested it with qt4, but with gtk, add_axes DOES work.

So, can you try other backends and see if they work?

And, I believe that add_subplot -> add_axes is a only change you made?

Unless the problem is persistent among other backends, I hope other
developers who use qt4 backend step in and help.

Regards,

-JJ

···

On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou <LDufrechou@...2817...> wrote:

Hello,

I’ve just discovered blitting technique to improve performances.

I’m using this example
http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4.html

I encounter an issue if instead of using subplot I use add_axes method to
hand define where I want my plot.

In this case blitting is no more working like if restore_region was not
restoring context…

def __init__(self):

    FigureCanvas\.\_\_init\_\_\(self, Figure\(\)\)

    \#self\.ax = self\.figure\.add\_subplot\(111\)

    self\.ax = self\.figure\.add\_axes\(\[0\.1,0\.1,0\.8,0\.2\]\)

Any idea why in this case the example given is not working?

Cheers,

Laurent

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Hello,

I've tested so far with wx and QT4 backend.
The two are buggy.
Easy way to reproduce the bug (another way I mean)

ax = p.subplot(212)
ax2 = p.subplot(211)

and the two backends got the same error.

Note that I'm under windows. I'll try under linux tonight just to check.
I'll also try gtk backend as you suggest.

Update in next email :slight_smile:

···

-----Message d'origine-----
De : Jae-Joon Lee [mailto:lee.j.joon@…287…]
Envoyé : mardi 13 octobre 2009 18:36
À : Laurent Dufrechou
Cc : matplotlib-users@lists.sourceforge.net
Objet : Re: [Matplotlib-users] Little issue with blitting technique

I haven't tested it with qt4, but with gtk, add_axes DOES work.

So, can you try other backends and see if they work?

And, I believe that add_subplot -> add_axes is a only change you made?

Unless the problem is persistent among other backends, I hope other
developers who use qt4 backend step in and help.

Regards,

-JJ

On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou > <LDufrechou@...2817...> wrote:
> Hello,
>
>
>
> I’ve just discovered blitting technique to improve performances.
>
> I’m using this example
>
http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
.html
>
>
>
> I encounter an issue if instead of using subplot I use add_axes
method to
> hand define where I want my plot.
>
> In this case blitting is no more working like if restore_region was
not
> restoring context…
>
>
>
> def __init__(self):
>
> FigureCanvas.__init__(self, Figure())
>
>
>
> #self.ax = self.figure.add_subplot(111)
>
> self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
>
>
>
> Any idea why in this case the example given is not working?
>
>
>
> Cheers,
>
> Laurent
>
> ---------------------------------------------------------------------
---------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart
your
> developing skills, take BlackBerry mobile applications to market and
stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options
>
>

I've just installer GTK on windows + tested your file and it works...
Moreover, I've modified the source to make the code use QT4Agg instead of GTK and the bug does not appears.
So I think it is more an issue of misusing bliting technique in other examples.
(still your gtk example is more beautiful but 10 times slower than other examples, so is blitting really working in this case ?)

I'll dig this a little more but any idea welcome :slight_smile:

···

-----Message d'origine-----
De : Laurent Dufrechou [mailto:LDufrechou@…2817…]
Envoyé : mardi 13 octobre 2009 19:02
À : Jae-Joon Lee
Cc : matplotlib-users@lists.sourceforge.net
Objet : Re: [Matplotlib-users] Little issue with blitting technique

Hello,

I've tested so far with wx and QT4 backend.
The two are buggy.
Easy way to reproduce the bug (another way I mean)

ax = p.subplot(212)
ax2 = p.subplot(211)

and the two backends got the same error.

Note that I'm under windows. I'll try under linux tonight just to
check.
I'll also try gtk backend as you suggest.

Update in next email :slight_smile:

> -----Message d'origine-----
> De : Jae-Joon Lee [mailto:lee.j.joon@…287…]
> Envoyé : mardi 13 octobre 2009 18:36
> À : Laurent Dufrechou
> Cc : matplotlib-users@lists.sourceforge.net
> Objet : Re: [Matplotlib-users] Little issue with blitting technique
>
> I haven't tested it with qt4, but with gtk, add_axes DOES work.
>
> So, can you try other backends and see if they work?
>
> And, I believe that add_subplot -> add_axes is a only change you
made?
>
> Unless the problem is persistent among other backends, I hope other
> developers who use qt4 backend step in and help.
>
> Regards,
>
> -JJ
>
>
> On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou > > <LDufrechou@...2817...> wrote:
> > Hello,
> >
> >
> >
> > I’ve just discovered blitting technique to improve performances.
> >
> > I’m using this example
> >
>
http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
> .html
> >
> >
> >
> > I encounter an issue if instead of using subplot I use add_axes
> method to
> > hand define where I want my plot.
> >
> > In this case blitting is no more working like if restore_region was
> not
> > restoring context…
> >
> >
> >
> > def __init__(self):
> >
> > FigureCanvas.__init__(self, Figure())
> >
> >
> >
> > #self.ax = self.figure.add_subplot(111)
> >
> > self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
> >
> >
> >
> > Any idea why in this case the example given is not working?
> >
> >
> >
> > Cheers,
> >
> > Laurent
> >
> > -------------------------------------------------------------------
--
> ---------
> > Come build with us! The BlackBerry(R) Developer Conference in SF,
CA
> > is the only developer event you need to attend this year. Jumpstart
> your
> > developing skills, take BlackBerry mobile applications to market
and
> stay
> > ahead of the curve. Join us from November 9 - 12, 2009. Register
now!
> > http://p.sf.net/sfu/devconference
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > matplotlib-users List Signup and Options
> >
> >
-----------------------------------------------------------------------
-------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart
your
developing skills, take BlackBerry mobile applications to market and
stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Hey, coparing on how GTK2 example is done I've seen a difference between the two!

In QT4Agg example and WX example the code use:

canvas.copy_from_bbox(ax.bbox)
replacing all occurrence of ax.bbox with ax.get_figure().bbox solved all the issue I add.

Perhaps we should correct the examples.
I can send you the good working example if you want.

Cheers,
Laurent

···

-----Message d'origine-----
De : Laurent Dufrechou [mailto:LDufrechou@…2817…]
Envoyé : mardi 13 octobre 2009 19:02
À : Jae-Joon Lee
Cc : matplotlib-users@lists.sourceforge.net
Objet : Re: [Matplotlib-users] Little issue with blitting technique

Hello,

I've tested so far with wx and QT4 backend.
The two are buggy.
Easy way to reproduce the bug (another way I mean)

ax = p.subplot(212)
ax2 = p.subplot(211)

and the two backends got the same error.

Note that I'm under windows. I'll try under linux tonight just to
check.
I'll also try gtk backend as you suggest.

Update in next email :slight_smile:

> -----Message d'origine-----
> De : Jae-Joon Lee [mailto:lee.j.joon@…287…]
> Envoyé : mardi 13 octobre 2009 18:36
> À : Laurent Dufrechou
> Cc : matplotlib-users@lists.sourceforge.net
> Objet : Re: [Matplotlib-users] Little issue with blitting technique
>
> I haven't tested it with qt4, but with gtk, add_axes DOES work.
>
> So, can you try other backends and see if they work?
>
> And, I believe that add_subplot -> add_axes is a only change you
made?
>
> Unless the problem is persistent among other backends, I hope other
> developers who use qt4 backend step in and help.
>
> Regards,
>
> -JJ
>
>
> On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou > > <LDufrechou@...2817...> wrote:
> > Hello,
> >
> >
> >
> > I’ve just discovered blitting technique to improve performances.
> >
> > I’m using this example
> >
>
http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
> .html
> >
> >
> >
> > I encounter an issue if instead of using subplot I use add_axes
> method to
> > hand define where I want my plot.
> >
> > In this case blitting is no more working like if restore_region was
> not
> > restoring context…
> >
> >
> >
> > def __init__(self):
> >
> > FigureCanvas.__init__(self, Figure())
> >
> >
> >
> > #self.ax = self.figure.add_subplot(111)
> >
> > self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
> >
> >
> >
> > Any idea why in this case the example given is not working?
> >
> >
> >
> > Cheers,
> >
> > Laurent
> >
> > -------------------------------------------------------------------
--
> ---------
> > Come build with us! The BlackBerry(R) Developer Conference in SF,
CA
> > is the only developer event you need to attend this year. Jumpstart
> your
> > developing skills, take BlackBerry mobile applications to market
and
> stay
> > ahead of the curve. Join us from November 9 - 12, 2009. Register
now!
> > http://p.sf.net/sfu/devconference
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > matplotlib-users List Signup and Options
> >
> >
-----------------------------------------------------------------------
-------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart
your
developing skills, take BlackBerry mobile applications to market and
stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Hello,

I've tested so far with wx and QT4 backend.
The two are buggy.
Easy way to reproduce the bug (another way I mean)

ax = p.subplot(212)
ax2 = p.subplot(211)

On mac with wxgtk, it works fine.
Maybe this is an windows only issue.

and the two backends got the same error.

Since nobody steped in, and I don't use windows, can you file a bug report.

Please provide a short, complete example that reproduces the bug. Also
the error message you get.

-JJ

···

On Tue, Oct 13, 2009 at 1:02 PM, Laurent Dufrechou <LDufrechou@...2817...> wrote:

Note that I'm under windows. I'll try under linux tonight just to check.
I'll also try gtk backend as you suggest.

Update in next email :slight_smile:

-----Message d'origine-----
De : Jae-Joon Lee [mailto:lee.j.joon@…287…]
Envoyé : mardi 13 octobre 2009 18:36
À : Laurent Dufrechou
Cc : matplotlib-users@lists.sourceforge.net
Objet : Re: [Matplotlib-users] Little issue with blitting technique

I haven't tested it with qt4, but with gtk, add_axes DOES work.

So, can you try other backends and see if they work?

And, I believe that add_subplot -> add_axes is a only change you made?

Unless the problem is persistent among other backends, I hope other
developers who use qt4 backend step in and help.

Regards,

-JJ

On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou >> <LDufrechou@...2817...> wrote:
> Hello,
>
>
>
> I’ve just discovered blitting technique to improve performances.
>
> I’m using this example
>
http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
.html
>
>
>
> I encounter an issue if instead of using subplot I use add_axes
method to
> hand define where I want my plot.
>
> In this case blitting is no more working like if restore_region was
not
> restoring context…
>
>
>
> def __init__(self):
>
> FigureCanvas.__init__(self, Figure())
>
>
>
> #self.ax = self.figure.add_subplot(111)
>
> self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
>
>
>
> Any idea why in this case the example given is not working?
>
>
>
> Cheers,
>
> Laurent
>
> ---------------------------------------------------------------------
---------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart
your
> developing skills, take BlackBerry mobile applications to market and
stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options
>
>

Hey, coparing on how GTK2 example is done I've seen a difference between the two!

In QT4Agg example and WX example the code use:

canvas.copy_from_bbox(ax.bbox)
replacing all occurrence of ax.bbox with ax.get_figure().bbox solved all the issue I add.

I'm not sure why using ax.bbox does not work, and it SHOULD work.
Note that animation_blit_gtk.py DOES use ax.bbox.

Perhaps we should correct the examples.
I can send you the good working example if you want.

If using ax.bbox does not work, than it is a bug (either mpl or the example).
Unfortunately, this seems to happen only on windows.
So, please file a bug report (again).

Regards,

-JJ

···

On Tue, Oct 13, 2009 at 5:06 PM, Laurent Dufréchou <laurent.dufrechou@...287...> wrote:

Cheers,
Laurent

-----Message d'origine-----
De : Laurent Dufrechou [mailto:LDufrechou@…2817…]
Envoyé : mardi 13 octobre 2009 19:02
À : Jae-Joon Lee
Cc : matplotlib-users@lists.sourceforge.net
Objet : Re: [Matplotlib-users] Little issue with blitting technique

Hello,

I've tested so far with wx and QT4 backend.
The two are buggy.
Easy way to reproduce the bug (another way I mean)

ax = p.subplot(212)
ax2 = p.subplot(211)

and the two backends got the same error.

Note that I'm under windows. I'll try under linux tonight just to
check.
I'll also try gtk backend as you suggest.

Update in next email :slight_smile:

> -----Message d'origine-----
> De : Jae-Joon Lee [mailto:lee.j.joon@…287…]
> Envoyé : mardi 13 octobre 2009 18:36
> À : Laurent Dufrechou
> Cc : matplotlib-users@lists.sourceforge.net
> Objet : Re: [Matplotlib-users] Little issue with blitting technique
>
> I haven't tested it with qt4, but with gtk, add_axes DOES work.
>
> So, can you try other backends and see if they work?
>
> And, I believe that add_subplot -> add_axes is a only change you
made?
>
> Unless the problem is persistent among other backends, I hope other
> developers who use qt4 backend step in and help.
>
> Regards,
>
> -JJ
>
>
> On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou >> > <LDufrechou@...2817...> wrote:
> > Hello,
> >
> >
> >
> > I’ve just discovered blitting technique to improve performances.
> >
> > I’m using this example
> >
>
http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
> .html
> >
> >
> >
> > I encounter an issue if instead of using subplot I use add_axes
> method to
> > hand define where I want my plot.
> >
> > In this case blitting is no more working like if restore_region was
> not
> > restoring context…
> >
> >
> >
> > def __init__(self):
> >
> > FigureCanvas.__init__(self, Figure())
> >
> >
> >
> > #self.ax = self.figure.add_subplot(111)
> >
> > self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
> >
> >
> >
> > Any idea why in this case the example given is not working?
> >
> >
> >
> > Cheers,
> >
> > Laurent
> >
> > -------------------------------------------------------------------
--
> ---------
> > Come build with us! The BlackBerry(R) Developer Conference in SF,
CA
> > is the only developer event you need to attend this year. Jumpstart
> your
> > developing skills, take BlackBerry mobile applications to market
and
> stay
> > ahead of the curve. Join us from November 9 - 12, 2009. Register
now!
> > http://p.sf.net/sfu/devconference
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > matplotlib-users List Signup and Options
> >
> >
-----------------------------------------------------------------------
-------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart
your
developing skills, take BlackBerry mobile applications to market and
stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

What example do you mean?
The performance will depend on complexity of the plot items that need
to be drawn every time. So, some example may be slower than others.

-JJ

···

On Tue, Oct 13, 2009 at 4:53 PM, Laurent Dufréchou <laurent.dufrechou@...287...> wrote:

(still your gtk example is more beautiful but 10 times slower than other examples, so is blitting really working in this case ?)

Bug reported:

https://sourceforge.net/tracker/index.php?func=detail&aid=2880692&group_id=80706&atid=560720

Does anybody where I could dig a little to try to correct it?
It a really needed feature for me, so if I could help...

Cheers,
Laurent

···

-----Message d'origine-----
De : Jae-Joon Lee [mailto:lee.j.joon@…287…]
Envoyé : jeudi 15 octobre 2009 05:23
À : Laurent Dufrechou
Cc : matplotlib-users@lists.sourceforge.net
Objet : Re: [Matplotlib-users] Little issue with blitting technique

On Tue, Oct 13, 2009 at 1:02 PM, Laurent Dufrechou > <LDufrechou@...2817...> wrote:
> Hello,
>
> I've tested so far with wx and QT4 backend.
> The two are buggy.
> Easy way to reproduce the bug (another way I mean)
>
> ax = p.subplot(212)
> ax2 = p.subplot(211)
>

On mac with wxgtk, it works fine.
Maybe this is an windows only issue.

> and the two backends got the same error.

Since nobody steped in, and I don't use windows, can you file a bug
report.

matplotlib download | SourceForge.net

Please provide a short, complete example that reproduces the bug. Also
the error message you get.

-JJ

>
> Note that I'm under windows. I'll try under linux tonight just to
check.
> I'll also try gtk backend as you suggest.
>
> Update in next email :slight_smile:
>
>> -----Message d'origine-----
>> De : Jae-Joon Lee [mailto:lee.j.joon@…287…]
>> Envoyé : mardi 13 octobre 2009 18:36
>> À : Laurent Dufrechou
>> Cc : matplotlib-users@lists.sourceforge.net
>> Objet : Re: [Matplotlib-users] Little issue with blitting technique
>>
>> I haven't tested it with qt4, but with gtk, add_axes DOES work.
>>
>> So, can you try other backends and see if they work?
>>
>> And, I believe that add_subplot -> add_axes is a only change you
made?
>>
>> Unless the problem is persistent among other backends, I hope other
>> developers who use qt4 backend step in and help.
>>
>> Regards,
>>
>> -JJ
>>
>>
>> On Thu, Oct 8, 2009 at 11:30 AM, Laurent Dufrechou > >> <LDufrechou@...2817...> wrote:
>> > Hello,
>> >
>> >
>> >
>> > I’ve just discovered blitting technique to improve performances.
>> >
>> > I’m using this example
>> >
>>
http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4
>> .html
>> >
>> >
>> >
>> > I encounter an issue if instead of using subplot I use add_axes
>> method to
>> > hand define where I want my plot.
>> >
>> > In this case blitting is no more working like if restore_region
was
>> not
>> > restoring context…
>> >
>> >
>> >
>> > def __init__(self):
>> >
>> > FigureCanvas.__init__(self, Figure())
>> >
>> >
>> >
>> > #self.ax = self.figure.add_subplot(111)
>> >
>> > self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2])
>> >
>> >
>> >
>> > Any idea why in this case the example given is not working?
>> >
>> >
>> >
>> > Cheers,
>> >
>> > Laurent
>> >
>> > ------------------------------------------------------------------
---
>> ---------
>> > Come build with us! The BlackBerry(R) Developer Conference in SF,
CA
>> > is the only developer event you need to attend this year.
Jumpstart
>> your
>> > developing skills, take BlackBerry mobile applications to market
and
>> stay
>> > ahead of the curve. Join us from November 9 - 12, 2009. Register
now!
>> > http://p.sf.net/sfu/devconference
>> > _______________________________________________
>> > Matplotlib-users mailing list
>> > Matplotlib-users@lists.sourceforge.net
>> > matplotlib-users List Signup and Options
>> >
>> >
>