If I try to format the text using tex in a figure where a colorbar is
present, I get the following error:

Traceback (most recent call last):

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py",
line 59, in draw_wrapper

    draw(artist, renderer, *args, **kwargs)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py",
line 1079, in draw

    func(*args)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py",
line 59, in draw_wrapper

    draw(artist, renderer, *args, **kwargs)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/_base.py",
line 2092, in draw

    a.draw(renderer)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py",
line 59, in draw_wrapper

    draw(artist, renderer, *args, **kwargs)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axis.py",
line 1116, in draw

    renderer)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axis.py",
line 1068, in _get_tick_bboxes

    extent = tick.label2.get_window_extent(renderer)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/text.py",
line 741, in get_window_extent

    bbox, info, descent = self._get_layout(self._renderer)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/text.py",
line 320, in _get_layout

    ismath=ismath)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py",
line 154, in get_text_width_height_descent

    renderer=self)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/texmanager.py",
line 670, in get_text_width_height_descent

    dvifile = self.make_dvi(tex, fontsize)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/texmanager.py",
line 394, in make_dvi

    texfile = self.make_tex(tex, fontsize)

  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/texmanager.py",
line 309, in make_tex

    fh.write(s.encode('ascii'))

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2212' in
position 297: ordinal not in range(128)

I am using the MacPorts installation of matplotlib on OS X 10.9.  I can
generate this error by adding the line:
plt.rc('text', usetex=True)

to any example code that has a colorbar, (i.e., griddata_demo.py).  The
consequence of this error is that the figure does not have any text on the
colorbar axis.

-- 
gideon
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to