From: John H. <jdh...@ac...> - 2004-09-22 13:03:51
|
>>>>> "Patrik" == Patrik Simons <pat...@ne...> writes: Patrik> Here's a proposed patch for the caching problem in Patrik> text.py. (I'm sending it before someone actually adds Patrik> matplotlib.text.Text.cached = {} to, e.g., Patrik> matlab.close(). Oh, the horror :-) What happened when you put it there? It's not clear to me where to me where that misplaced zero is coming from. Since the two figures are identical in size, I would think the cached location of '0' from the first iteration of the loop would be suitable for the second iteration. Do you understand how this is failing? The main reason for the cache was for efficiency in animated plots. Eg, if you are just updating the data in a plot and then redrawing, you don't want to do all the number crunching for text layout. With rotated text and matrix operations to get the layout right, this can get expensive. I read over your patch. I wonder if a simpler and cleaner solution might just be to move the cached into the __init__ method. Ie, make it instance specific. This would still provide the cache efficiency for animated plots, but should fix the problem you encountered. It might also be less mind-bending than the solution you posted, at least at this hour of the morning :-) But I *would* like to understand how the current situation is failing. I note that it does not occur if you replace figure(1) with figure(i+1). JDH |