Below is the minimum code with the right indent

import pylab
def test(n):
     for i in range(n):
          f=pylab.figure(1)
          f.clf()
          a=f.add_axes([0.2, 0.2, 0.6, 0.6])
          a.plot([1,2,3,4,5], 'ro')

On Dec 2, 2007 4:07 PM, Yongtao Cui <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I got the following error when clearing and plotting on the same
> figure for many times. I found the following minimum code to reproduce
> this error. I am using matplotlib-0.91.1 and wxpython2.8 on windows
> xp. In the matplotlibrc file, I changed the backend to WXAgg and
> interactive to True.
>
> import pylab
> def test(n):
>    for i in range(n):
>        f=pylab.figure(1)
>        f.clf()
>        a=f.add_axes([0.2, 0.2, 0.6, 0.6])
>        a.plot([1,2,3,4,5], 'ro')
>
>
> The error only happens for a large n. For example, test(10) works
> fine, but test(50) will cause the error. Also runing test(10) for a
> few times will also cause the error.
>
> Could anyone give me some help?
>
> Thanks.
>
> The following is the error message:
>
> Traceback (most recent call last):
>  File "<input>", line 1, in <module>
>  File "<input>", line 3, in test
>  File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 191, in 
> figure
>  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
> line 1227, in draw_if_interactive
>  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
> line 61, in draw
>  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> line 380, in draw
>  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 612, in draw
>  File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1344, in draw
>  File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 596, in draw
>  File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 170, in draw
>  File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 775, in draw
>  File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 317, in draw
>  File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 195,
> in _get_layout
>  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> line 234, in get_text_width_height_descent
>  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> line 301, in _get_agg_font
> RuntimeError: Could not open facefile
> C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf;
> Cannot_Open_Resource
>

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to