Hi,
annotate and usetex='True' can trigger a traceback if the text is invalid. A space or an underscore generate this behavior, I haven't tried others.
Ubuntu 8.10, mpl svn (rev. 7032).
Once again feel free to ignore this, I just feel compelled to report all mpl bugs
JLS
Example:
路路路
#---------------------------------------------------------------------------
from matplotlib import rc
rc('text', usetex=True)
rc('font', family='serif')
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-10.0,10.0,0.1)
plt.plot(x,np.sin(x))
ax = plt.gca()
ax.annotate(' ',xy=(-5.8,0.5),xytext=(-8.0,0.5),
聽聽聽聽聽聽聽聽聽聽聽聽聽arrowprops=dict(facecolor='black',width=1.5, shrink=0.05))
plt.show()
#---------------------------------------------------------------------------
Traceback:
Traceback (most recent call last):
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py", line 352, in expose_event
聽聽聽聽聽self._render_figure(self._pixmap, w, h)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py", line 75, in _render_figure
聽聽聽聽聽FigureCanvasAgg.draw(self)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", line 283, in draw
聽聽聽聽聽self.figure.draw(self.renderer)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 773, in draw
聽聽聽聽聽for a in self.axes: a.draw(renderer)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 1672, in draw
聽聽聽聽聽a.draw(renderer)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 1615, in draw
聽聽聽聽聽self.update_positions(renderer)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 1542, in update_positions
聽聽聽聽聽l,b,w,h = self.get_window_extent(renderer).bounds
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 662, in get_window_extent
聽聽聽聽聽bbox, info = self._get_layout(self._renderer)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 253, in _get_layout
聽聽聽聽聽clean_line, self._fontproperties, ismath=ismath)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py", line 152, in get_text_width_height_descent
聽聽聽聽聽renderer=self)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/texmanager.py", line 594, in get_text_width_height_descent
聽聽聽聽聽dvi = dviread.Dvi(dvifile, 72*dpi_fraction)
聽聽聽File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 45, in __init__
聽聽聽聽聽self.file = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: '/home/jls/.matplotlib/tex.cache/557ff391b6beb8d5df7a86de0547f607.dvi'