I have fixed it. Or, I have a better handle on what the stupid thing is 
doing. LOL.

The problem was a couple of things.

1. Michael was right. There was no file named Helvetica.ttf installed 
on my machine.

2. The path were I thought MPL was looking for files wasn't the right 
path. I thought it was looking in the mpl-data/fonts/ttf directory... 
Which it does. But it ALSO looks in system's font directories. So I was 
finding fonts that weren't in the mpl-data directory. This was very 
confusing.

3. I was generally angry at it.


Now, if you want to change the font, just look in the system's font 
directory, pick the one you want, and then change the font.family name. 
It will change everything else. Easy as pie.



On Tue Sep 25 15:59:10 2012, Steven Boada wrote:
> I fail to understand what I am doing wrong and how I supposed to fix it....
>
> using backend :TkAgg
>
> Again in ipython, after I have imported rc from matplotlib...
>
> In [5]: rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>
> In [6]: figure()
> Out[6]: <matplotlib.figure.Figure at 0x104bc6890>
>
> In [7]: xlabel('z')
> Out[7]: <matplotlib.text.Text at 0x104bd05d0>
>
> In [8]:
> /opt/python/lib/python2.7/site-packages/matplotlib/font_manager.py:1214:
> UserWarning: findfont: Font family ['sans-serif'] not found. Falling
> back to Bitstream Vera Sans
>     (prop.get_family(), self.defaultFamily[fontext]))
>
>
> This fails...
>
> In [8]: rc('font',**{'family':'serif','serif':['times new roman']})
>
> In [9]: xlabel('z')
> Out[9]: <matplotlib.text.Text at 0x104bd05d0>
>
>
> This works fine. The labels on the plot change and everything. Neither
> of these two fonts are located in the ttf directory. Both seem to be in
> the pdfcorefonts directory, and both have afm extensions..
>
>
> This should not be this hard...
>
> Steven
>
>
>
> On 9/25/12 1:04 PM, Michael Droettboom wrote:
>> Those *.afm fonts are only available in the postscript backend when
>> "ps.usecorefonts" is set to True. Otherwise, you have to use
>> TrueType/OpenType fonts.
>>
>> Mike
>>
>> On 09/25/2012 12:11 PM, Steven Boada wrote:
>>> Hey Mike
>>>
>>> $ fc-match Helvetica
>>> n019003l.pfb: "Nimbus Sans L" "Regular"
>>>
>>>
>>> Perhaps I don't have the fonts installed...
>>>
>>> In my matplotlib/mpl-data/fonts/ I have the following fonts installed...
>>>
>>> in ttf/
>>>
>>> cmb10.ttf      RELEASENOTES.TXT       STIXSizFourSymBol.ttf VeraIt.ttf
>>> cmex10.ttf     STIXGeneralBolIta.ttf  STIXSizFourSymReg.ttf VeraMoBd.ttf
>>> cmmi10.ttf     STIXGeneralBol.ttf     STIXSizOneSymBol.ttf VeraMoBI.ttf
>>> cmr10.ttf      STIXGeneralItalic.ttf  STIXSizOneSymReg.ttf VeraMoIt.ttf
>>> cmss10.ttf     STIXGeneral.ttf        STIXSizThreeSymBol.ttf VeraMono.ttf
>>> cmsy10.ttf     STIXNonUniBolIta.ttf   STIXSizThreeSymReg.ttf VeraSeBd.ttf
>>> cmtt10.ttf     STIXNonUniBol.ttf      STIXSizTwoSymBol.ttf VeraSe.ttf
>>> COPYRIGHT.TXT  STIXNonUniIta.ttf      STIXSizTwoSymReg.ttf Vera.ttf
>>> LICENSE_STIX   STIXNonUni.ttf         VeraBd.ttf
>>> README.TXT     STIXSizFiveSymReg.ttf  VeraBI.ttf
>>>
>>> and in pdfcorefonts
>>>
>>> Courier.afm              Helvetica-Bold.afm         Times-Bold.afm
>>> Courier-Bold.afm         Helvetica-BoldOblique.afm Times-BoldItalic.afm
>>> Courier-BoldOblique.afm  Helvetica-Oblique.afm      Times-Italic.afm
>>> Courier-Oblique.afm      readme.txt                 Times-Roman.afm
>>> Helvetica.afm            Symbol.afm                 ZapfDingbats.afm
>>>
>>>
>>> Which does include some Helvetica fonts. And the font that I am trying
>>> to use doesn't *have* to be helvetica. I just like that font, so I was
>>> playing with it.
>>>
>>> Steven
>>>
>>>
>>> On 9/25/12 10:41 AM, Michael Droettboom wrote:
>>>> Do you have a font installed called Helvetica?  That's pretty rare these
>>>> days...  most systems have one of the many Helvetica clones instead.
>>>>
>>>> Does "fc-match Helvetica" (at the commandline) return anything?
>>>>
>>>> Mike
>>>>
>>>> On 09/25/2012 10:05 AM, Steven Boada wrote:
>>>>> List,
>>>>>
>>>>> I am trying, with little success, to change the fonts on my plots. It
>>>>> seems like a simple thing to do, but I can't seem to make it work.
>>>>>
>>>>> First, here is the relevant section of my Matplotlibrc file:
>>>>>
>>>>> backend      : GTKAgg
>>>>>
>>>>> font.family         : sans-serif
>>>>> font.style          : normal
>>>>> font.weight         : medium
>>>>> font.sans-serif     : Helvetica
>>>>>
>>>>> (I copied this from the Matplotlibrc documentation page)
>>>>>
>>>>>
>>>>> Now if I make a plot, and put some labels on there... (just using ipython)
>>>>>
>>>>> In [3]: figure()
>>>>> Out[3]: <matplotlib.figure.Figure at 0x2acb950>
>>>>>
>>>>> In [4]: xlabel('Hz',fontsize=20)
>>>>> Out[4]: <matplotlib.text.Text at 0x2ae3510>
>>>>>
>>>>> In [5]:
>>>>> /opt/python/lib/python2.7/site-packages/matplotlib/font_manager.py:1216:
>>>>> UserWarning: findfont: Font family ['sans-serif'] not found. Falling
>>>>> back to Bitstream Vera Sans
>>>>>         (prop.get_family(), self.defaultFamily[fontext]))
>>>>>
>>>>>
>>>>> I get this over and over and over again. I have deleted everything in my
>>>>> ~/.matplotlib folder. That is, I have deleted all of the font caches...
>>>>> I can't come up with anything else. The internet seems to thing that
>>>>> just deleting the caches will fix everything. In my case it doesn't.
>>>>>
>>>>> I get this problem on both my mac, and my Ubuntu Linux 12.04 machine.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Steven
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Live Security Virtual Conference
>>>>> Exclusive live event will cover all the ways today's security and
>>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>>> will include endpoint security, mobile security and the latest in malware
>>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>>> _______________________________________________
>>>>> Matplotlib-users mailing list
>>>>> Matplotlib-users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>> ------------------------------------------------------------------------------
>>>> Live Security Virtual Conference
>>>> Exclusive live event will cover all the ways today's security and
>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>> will include endpoint security, mobile security and the latest in malware
>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Matplotlib-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>

--

Steven Boada

Doctoral Student
Dept of Physics and Astronomy
Texas A&M University
bo...@physics.tamu.edu

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to