math symbols with matplotlib basemap

Hi there,

I wonder if there is I way how to use math symbols together with the basemap class.

Here is my problem:

The lines

import matplotlib.pyplot as plt

plt.text(0.06 , 0.04, r"200 $\Omega$ m", fontsize=10, transform=plt.gca().transAxes)

work with a standard plot. However if I use basemap, I get the following error:

File “/usr/lib/pymodules/python2.6/matplotlib/text.py”, line 280, in _get_layout

clean_line, self._fontproperties, ismath=ismath)

File “/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py”, line 156, in get_text_width_height_descent

self.mathtext_parser.parse(s, self.dpi, prop)

File
“/usr/lib/pymodules/python2.6/matplotlib/mathtext.py”, line 2797, in parse

font_output = fontset_class(prop, backend)

File “/usr/lib/pymodules/python2.6/matplotlib/mathtext.py”, line 658, in init

self._stix_fallback = StixFonts(*args, **kwargs)

File “/usr/lib/pymodules/python2.6/matplotlib/mathtext.py”, line 900, in init

fullpath = findfont(name)

File “/usr/lib/pymodules/python2.6/matplotlib/font_manager.py”, line 1306, in findfont

if not os.path.exists(font):

File “/usr/lib/python2.6/genericpath.py”, line 18, in exists

st = os.stat(path)

TypeError: coercing to Unicode: need string or buffer, dict found

Thank you
very much for your help!

Marko

I would try renaming the font cache file (in
~/.matplotlib/fontList.cache). It looks like it perhaps contains
some invalid data. If that works, can you send the old file to me
(off list) so I can try to get to the bottom of how it got
corrupted?

Mike
···

http://p.sf.net/sfu/splunk-d2d-c2


Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users

-- Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA