From: James B. <bo...@ll...> - 2006-03-29 00:05:54
|
Running OS X 10.3.9 matplotlib 0.87.2 If I run: import matplotlib matplotlib.use('PS') from matplotlib import pylab import Numeric N = Numeric PL = pylab x = N.arrayrange(100.) y = N.arrayrange(100.) PL.plot(x,y**2) PL.savefig('crap') PL.clf() with the default matplotlibrc setting: font.sans-serif : Lucida Grande, Verdana, Geneva, Lucida, Bitstream Vera Sans, Arial, Helvetica, Avant Garde, sans-serif I get a postscript file that I cannot view. BUT if I change the matplotlibrc file to: font.sans-serif : Bitstream Vera Sans All goes well and the PS file is fine. This has been discussed on the list previously as an OS X font issue. My idea was to use the following code to set the font.sans-serif dynamically. However, it does not seem to work in that the ps file is not usable as if Lucida Grande was still the font.sans-serif setting. There might well be something very obvious - From the font manager code I surmised that the 'sans-serif' entry was a list but I could be mistaken: import matplotlib matplotlib.use('PS') from matplotlib import pylab import Numeric N = Numeric PL = pylab x = N.arrayrange(100.) y = N.arrayrange(100.) fontDict = {'family':'sans-serif', 'style': 'normal', 'variant':'normal', 'weight': 'medium', 'stretch':'normal', 'size': 12.0, 'sans-serif':['Bitstream Vera Sans']} PL.rc('font',**fontDict) PL.plot(x,y**2) PL.savefig('crap') PL.clf() --Jim On Mar 28, 2006, at 10:51 AM, Darren Dale wrote: > Please post a full example > > On Tuesday 28 March 2006 12:23, you wrote: >> I am in the midst of battling the OS X postscript font idiosyncrasies. >> I wish to switch to: >> font.sans-serif : Bitstream Vera Sans >> >> so that I can produce usable postscript files. This works fine if I >> edit the matplotlibrc file and run the code. >> BUT I figured it would be better to do this in the code, since I only >> want this for the PS backend. >> I thought that the following should produce the same result as editing >> the matplotlibrc file but it apparently does not. >> >> fontDict = {'family':'sans-serif', >> 'style': 'normal', >> 'variant':'normal', >> 'weight': 'medium', >> 'stretch':'normal', >> 'size': 12.0, >> 'sans-serif':['Bitstream Vera Sans']} >> pylab.rc('font',**fontDict) >> >> >> What (probably obvious) am I missing? >> By the way pylab.rc('text',usetex = True) works fine for me to yield >> good PS. >> >> --Jim >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by xPML, a groundbreaking scripting >> language >> that extends applications into web and mobile media. Attend the live >> webcast and join the prime developer group breaking into this new >> coding >> territory! >> http://sel.as-us.falkag.net/sel? >> cmd=lnk&kid=110944&bid=241720&dat=121642 >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- > Darren S. Dale, Ph.D. > Cornell High Energy Synchrotron Source > Cornell University > 200L Wilson Lab > Rt. 366 & Pine Tree Road > Ithaca, NY 14853 > > dd...@co... > office: (607) 255-9894 > fax: (607) 255-9001 > |