PATCH: matplotlib.text.Text.cached causing problems

Here's a proposed patch for the caching problem in

    > (I'm sending it before someone actually adds
    > matplotlib.text.Text.cached = {} to, e.g.,
    > matlab.close(). Oh, the horror :slight_smile:

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

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 :slight_smile:

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