From: Yi Shang [mailto:mirandaisb...@gmail.com] 
Sent: Friday, August 27, 2010 17:33
 
Hi Ben,
Thanks for the reply. I did try to match font.family and font.$family and I am
using matplotlib 0.99.0. 
I did find something interesting...
 
For testing, I tried only using font.family line, (deleting font.$family
line). I got reasonable font for "monospace", "fantasy" "sans-serif" and
"serif" family, but "cursive" looked exactly the same as "sans-serif", which
is the default font.family value.

Do you have any of the fonts in plt.rcParams['font.cursive']? If not,
matplotlib falls back to another font. You might have gotten a warning message
of the form "... font_manager.py:1242: UserWarning: findfont: Font family
['cursive'] not found. Falling back to Bitstream Vera Sans".

Then, I added font.$family line. When font.family and font.$family  match, as
you suggested, I always get the default font as if I only specified
font.family as sans-serif. {''font.family' : 'fantasy',  'font.fantasy' :
'Chicago'} gives me the default font, {''font.family' : 'fantasy',
'font.fantasy' : 'foo'} also gives me the default font ('Chicago is actually
in 'fantasy' family, 'foo' is not). 
 
Then I tried to mismatch font.family and font.$family, since they are not
matching, font.$family is not taking effect, I am getting whatever font.family
line is giving me.
 
I think the syntax I used may be wrong. Anyone has any idea how to specify a
specific font name within a font family?

The font families font.sans-serif, font.serif, etc., must be lists of names of
fonts, whereas font.family is a string naming either one of the families or a
font. So, you could use either

params = {'font.family' : 'sans-serif', 'font.sans-serif' : ['Arial']}

or

params = {'font.family' : 'Arial'}

to specify a font.

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to