[Matplotlib-users] small bugfix in font_manager.py

2010-11-24 Thread Daniel Hyams
MPL 1.0.0, OSX

If USE_FONTCONFIG is turned on, the function
FontProperties.get_size_in_points will sometimes fail, because it is wanting
to use "fontManager", which is still 'None' if USE_FONTCONFIG is on.  I'm
not sure if it's the proper way to fix it, but here is a small patch that
works (meaning that at least the code doesn't die; I can't vouch for much
else):

ORIGINAL:

def get_size_in_points(self):
if self._size is not None:
try:
return float(self._size)
except ValueError:
pass
default_size = fontManager.get_default_size()
return default_size * font_scalings.get(self._size)

NEW:

def get_size_in_points(self):
if self._size is not None:
try:
return float(self._size)
except ValueError:
pass
if fontManager:
   default_size = fontManager.get_default_size()
else:
   default_size = rcParams['font.size']
return default_size * font_scalings.get(self._size)


-- 
Daniel Hyams
dhy...@gmail.com
--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Latex text rendering

2010-11-24 Thread Jouni K . Seppänen
David Pine  writes:

> "name 'xpdf' is not defined"
>
> params = {'backend': 'Agg',
 ...
>   'ps.usedistiller' : xpdf,

Put xpdf in quotes: 'xpdf' not xpdf. In the matplotlibrc file you don't
need quotes there, but if you use Python to set parameters, you do.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Use a marker symbol in a text string

2010-11-24 Thread Alejandro Weinstein
On Tue, Nov 23, 2010 at 9:37 AM, Gökhan Sever  wrote:
> As I have learnt from Michael Droettboom, you can simply use unicode
> characters with a supported font set:
> In my setup I prefer DejaVu-Sans. First install these fonts into your
> system, then edit your matplotlibrc

Thanks for the answer. But I think there must be an easier way without
the need to install anything. After all, the legend command is able to
create text using the markers.

Alejandro.

--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Use a marker symbol in a text string

2010-11-24 Thread Alejandro Weinstein
On Tue, Nov 23, 2010 at 8:15 PM, Nicolas Bigaouette
 wrote:
> Why not just use latex?
> plt.text(0.05, 0.95, r"This is the square marker: $\Box$ Subscript: $_\Box$
> superscript: $^\Box$", fontsize=20)

It produces the following error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__
return self.func(*args)
  File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py",
line 212, in resize
self.show()
  File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py",
line 215, in draw
FigureCanvasAgg.draw(self)
  File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
line 314, in draw
self.figure.draw(self.renderer)
  File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
in draw_wrapper
draw(artist, renderer, *kl)
  File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 773, in draw
for a in self.axes: a.draw(renderer)
  File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
in draw_wrapper
draw(artist, renderer, *kl)
  File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1735, in draw
a.draw(renderer)
  File "/usr/lib/pymodules/python2.6/matplotlib/text.py", line 515, in draw
bbox, info = self._get_layout(renderer)
  File "/usr/lib/pymodules/python2.6/matplotlib/text.py", line 279, 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
2810, in parse
box = self._parser.parse(s, font_output, fontsize, dpi)
  File "/usr/lib/pymodules/python2.6/matplotlib/mathtext.py", line
2259, in parse
self._expression.parseString(s)
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
1048, in parseString
loc, tokens = self._parse( instring, 0 )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
value = self._parseNoCache( instring, loc, doActions, callPreParse )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2559, in parseImpl
return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
value = self._parseNoCache( instring, loc, doActions, callPreParse )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2307, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
value = self._parseNoCache( instring, loc, doActions, callPreParse )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2672, in parseImpl
loc, tokens = self.expr._parse( instring, loc, doActions,
callPreParse=False )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
value = self._parseNoCache( instring, loc, doActions, callPreParse )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2307, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
value = self._parseNoCache( instring, loc, doActions, callPreParse )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
924, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
2416, in parseImpl
ret = e._parse( instring, loc, doActions )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
981, in _parseCache
value = self._parseNoCache( instring, loc, doActions, callPreParse )
  File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line
950, in _parseNoCache
tokens = fn( instring, tokensStart, retTokens )
  File "/usr/lib/pymodules/python2.6/matplotlib/mathtext.py", line
1997, in raise_error
raise ParseFatalException(msg + "\n" + s)
ParseFatalException: Expected end of math '$'
This is the square marker: $\Box$  Subscript (at char 0), (line:1, col:1)

--