Issue with sample from website and rc()

Hi,

I've tried to set the size of the main font by doing:

import matplotlib.pyplot as pyplot

font = {'size' : 'larger'}

pyplot.rc('font', **font)

as indicated in
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.rc

It failed with:
    raise ValueError('Could not convert "%s" to float' % s)
ValueError: Could not convert "larger" to float

I'm using Matplotlib 0.99.1.2.

Matthieu

···

--
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher

The error is the 'size':'larger', not the passing as keyword arguments. Maybe
you try to stick (as "workaround") with a fixed number, like 'size':12

It's located in matplotlib/lib/matplotlib/rcsetup.py

def validate_float(s):
    'convert s to float or raise'
    try: return float(s)
    except ValueError:
        raise ValueError('Could not convert "%s" to float' % s)

-> conversion of 'larger' to float fails, I don't know, maybe this should go
through "validate_fontsize" instead of "validate_float"? Or, if failed in
validate_floats, to validate_fontsize? Like

def validate_float(s):
    'convert s to float or raise'
    try: return float(s) or validate_fontsize()
    except ValueError:
      raise ValueError('Could not convert "%s" to float' % s)

Regards,
Philipp

Indeed, with a fixed value, I could bypass this, but the main issue is
that the documentation says that it should work (xx-small, x-small,
small, medium, large, ... although I don't know if it should be
larger, as indicated in rc() doc, or large as indicated in the font
size doc IIRC).

Matthieu

2010/2/24 Philipp Bender <lists@...2935...>:

···

The error is the 'size':'larger', not the passing as keyword arguments. Maybe
you try to stick (as "workaround") with a fixed number, like 'size':12

It's located in matplotlib/lib/matplotlib/rcsetup.py

def validate_float(s):
'convert s to float or raise'
try: return float(s)
except ValueError:
raise ValueError('Could not convert "%s" to float' % s)

-> conversion of 'larger' to float fails, I don't know, maybe this should go
through "validate_fontsize" instead of "validate_float"? Or, if failed in
validate_floats, to validate_fontsize? Like

def validate_float(s):
'convert s to float or raise'
try: return float(s) or validate_fontsize()
except ValueError:
raise ValueError('Could not convert "%s" to float' % s)

Regards,
Philipp

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Information System Engineer, Ph.D.
Blog: http://matt.eifelle.com
LinkedIn: http://www.linkedin.com/in/matthieubrucher