more information on this. if i try to use pdf.use14corefonts, like was
suggested by Jouni, as follows:

from scipy import *
import matplotlib
matplotlib.use('PDF')
from matplotlib import rc
import matplotlib.pyplot as plt
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('pdf', use14corefonts=True)

then when i open the generated pdf in adobe illustrator i get the error:
"The font "Helvetica-Narrow" contains a bad /BBox."  -- then no labels are
shown in the graph, only the nontextual elements.



On Mon, Jun 29, 2009 at 4:46 PM, per freem <perfr...@gmail.com> wrote:

> hi all,
>
> I am not sure if I have helvetica installed as a TTF -- how can i install
> it if i don't?
>
> i followed the debug suggestion and here are the results. when i set the
> font to arial, using:
>
> from matplotlib import rc
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>
> then the relevant output i get using --verbose-debug is:
>
> matplotlib version 0.98.5.2
> Using fontManager instance from /Users/perf/.matplotlib/fontList.cache
> backend pdf version unknown
> findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> to Arial (/Library/Fonts/Arial.ttf) with score of 0.000000
> findfont: Matching
> :family=STIXGeneral:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXGeneral
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXNonUnicode:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0
> to STIXNonUnicode
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXGeneral:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0
> to STIXGeneral
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize3:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize3
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz3Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize4:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize4
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz4Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize5:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize5
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz5Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize1:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize1
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz1Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize2:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize2
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz2Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXGeneral:style=italic:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXGeneral
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXNonUnicode:style=italic:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXNonUnicode
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXNonUnicode:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXNonUnicode
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmb10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmb10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmtt10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmtt10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmmi10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmmi10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmex10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmex10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmsy10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmsy10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmr10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmr10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmss10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmss10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf)
> with score of 0.000000
>
> with the same line but this time setting the font to 'Helvetica', I get:
>
> matplotlib version 0.98.5.2
> Using fontManager instance from /Users/perf/.matplotlib/fontList.cache
> backend pdf version unknown
> findfont: Could not match
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium.
> Returning
> /Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
> findfont: Matching
> :family=STIXGeneral:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXGeneral
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXNonUnicode:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0
> to STIXNonUnicode
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXGeneral:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0
> to STIXGeneral
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize3:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize3
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz3Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize4:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize4
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz4Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize5:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize5
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz5Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize1:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize1
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz1Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXSize2:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXSize2
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz2Sym.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXGeneral:style=italic:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXGeneral
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXNonUnicode:style=italic:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXNonUnicode
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf)
> with score of 0.000000
> findfont: Matching
> :family=STIXNonUnicode:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to STIXNonUnicode
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmb10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmb10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmtt10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmtt10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmmi10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmmi10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmex10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmex10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmsy10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmsy10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmr10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmr10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf)
> with score of 0.000000
> findfont: Matching
> :family=cmss10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
> to cmss10
> (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf)
> with score of 0.000000
>
> any idea what might be wrong here?
>
>
> On Mon, Jun 29, 2009 at 8:47 AM, Michael Droettboom <md...@stsci.edu>wrote:
>
>> Are you certain you have Helvetica installed as a TrueType font?  If you
>> don't, the only way to get the Postscript Helvetica is to set "ps.useafm" to
>> True.
>>
>> Cheers,
>> Mike
>>
>> per freem wrote:
>>
>>> I just wanted to add: if i simply set the font to Arial, using
>>>
>>> rc('font',**{'family':'sans-serif','sans-serif':['Arial']})
>>>
>>> then it works. But the same call with Helvetica still defaults to that
>>> Bitstream/default font of matplotlib. any idea why this might be? could
>>> matplotlib be confusing helvetica with bitstream?
>>>
>>> On Sun, Jun 28, 2009 at 11:28 AM, per freem <perfr...@gmail.com <mailto:
>>> perfr...@gmail.com>> wrote:
>>>
>>>    hi,
>>>
>>>    i am trying to use the Helvetica font on matplotlib. i am using
>>>    mac os x (so i definitely have helvetica installed) with version
>>>    0.98.5.2 of matplotlib. my code is:
>>>
>>>    from scipy import *
>>>    import matplotlib
>>>    matplotlib.use('PDF')
>>>    from matplotlib import rc
>>>    import matplotlib.pyplot as plt
>>>    rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
>>>    plt.hist(rand(100))
>>>    xlabel(r"My x axis $\alpha$")
>>>    ylabel(r"My y axis $\beta$")
>>>
>>>    i verified that plt.rcParams gets modified to use 'Helvetica' as
>>>    the value for font.family, etc. but i still get the default font
>>>    used in all of these figures. i tried using the PS backend using
>>>    matplotlib.use('PS') but the problem persists. i am interested in
>>>    getting out PDFs that use helvetica everywhere.
>>>
>>>    does anyone know how to fix this? thank you.
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>  ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>> --
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>
>
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to