Slowdown in Canvas draw

Does this help? Should I tell the axes to "not remember"

    > the out-of-view data?

Yes, this appears to be your problem. Normally, I would adivse you to
update the data of your bar elements (patches.Rectangle instances).
This would avoid the overhead of creating all the extra objects. But
for stacked bar graphs this may be more hassle than it's worth.

But you definitely do need to clear the old instances before adding
the new ones. There are two ways to do this

  ax.cla() # clear all the axes elements

This might introduce flicker in to your graph so you'll have to test
it. A hack is to simply clear all the patch instances from the axes.
If you are not using other patch building plot commands (eg hist,
scatter, bar) this should work fine and be the fastest solution

  ax._patches =

It might be worthwhile to add a more limited clear function to the
axes. cla clears everything, but in some cases (like this one) you
might just want clear the lines, or the patches, or the text.

If you are following matplotlib-users, I just did some profiling of
animated graphs and found that text operations were eating up about
50% of the CPU time on animated graphs. The good news is that the
vast majority of this time can be reclaimed with some fairly easy
optimizations.

JDH

Thanks for your reply,

Problem solved!
I am now deleting all '_patches'-data beyond my viewing window's time frame which is set to 60 seconds.
I call:
  if len(ax._patches) > (60*10):
     del ax._patches[:10]

I have noticed that there are 10 entries made to the 'patches'-data for every bargraph I add.
Can you explain this - and/or possibly direct me to a page to read up more about "_patches".

Thanks for everything
Leon

···

On Tue, 25 May 2004 10:29:41 -0500, John Hunter <jdhunter@...5...> wrote:

    > Does this help? Should I tell the axes to "not remember"
    > the out-of-view data?

Yes, this appears to be your problem. Normally, I would adivse you to
update the data of your bar elements (patches.Rectangle instances).
This would avoid the overhead of creating all the extra objects. But
for stacked bar graphs this may be more hassle than it's worth.

But you definitely do need to clear the old instances before adding
the new ones. There are two ways to do this

  ax.cla() # clear all the axes elements

This might introduce flicker in to your graph so you'll have to test
it. A hack is to simply clear all the patch instances from the axes.
If you are not using other patch building plot commands (eg hist,
scatter, bar) this should work fine and be the fastest solution

  ax._patches =

It might be worthwhile to add a more limited clear function to the
axes. cla clears everything, but in some cases (like this one) you
might just want clear the lines, or the patches, or the text.

If you are following matplotlib-users, I just did some profiling of
animated graphs and found that text operations were eating up about
50% of the CPU time on animated graphs. The good news is that the
vast majority of this time can be reclaimed with some fairly easy
optimizations.

JDH