Re: [Matplotlib-users] setting figure font to helvetica
per freem perfr...@gmail.com writes: i am trying to use the Helvetica font on matplotlib. i am using mac os x (so i definitely have helvetica installed) It might be in a format that matplotlib doesn't really handle. However, Helvetica is one of the core fonts in PDF so if you set pdf.use14corefonts to True, you should be able to use Helvetica, and the reader application will supply the font (or approximate it with something else). This is deprecated in the latest version of the spec, but it should work just fine. 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 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? The font-selection system is somewhat complicated. I suggest running your script with --verbose-debug with both Arial and Helvetica as the value of font.sans-serif, and diffing the outputs to see what is going on. I suspect that Arial is a TTF file while Helvetica is in some Mac-specific format. The best solution would be to make matplotlib handle those formats, but probably the most practical solution is to use something like fondu to convert the font into TTF: http://fondu.sourceforge.net/ -- Jouni K. Seppänen http://www.iki.fi/jks -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] setting figure font to helvetica
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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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
Re: [Matplotlib-users] setting figure font to helvetica
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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 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.00 findfont: Matching :family=cmr10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0 to cmr10
[Matplotlib-users] setting figure font to helvetica
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.rcParams['font.family'] = 'Helvetica' plt.hist(rand(100)) xlabel(rMy x axis $\alpha$) ylabel(rMy 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
Re: [Matplotlib-users] setting figure font to helvetica
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 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(rMy x axis $\alpha$) ylabel(rMy 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