SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] Slowdown in Canvas draw

From: Leon B. <leo...@ne...> - 2004年05月26日 08:22:04
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 2004年5月25日 10:29:41 -0500, John Hunter 
<jdh...@ac...> wrote:
>>>>>> "Leon" == Leon Brits <leo...@ne...> writes:
>
> Leon> Does this help? Should I tell the axes to "not remember"
> Leon> 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

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /