From: James B. <bo...@ll...> - 2006-03-29 20:55:30
|
Thanks for your help. Encouraged by your results I tried some more experiments. There appears to be some hysteresis in matplotlib fonts ( at least my installation). Unsaid(!!!) in my message was that I initially ran the PS plot with the default fonts and generated a defective PS file, and then I tried to change the font properties. After running the rc(font, **fontDict) command I still generated a defective file but a different size - so something changed. However, if I just run the rc(font, **fontDict) command sequence first without ever trying the defaults fonts all goes well and I get a fine PS file. Evidently, some aspects of the old font are retained. Thanks again, --Jim On Mar 29, 2006, at 8:54 AM, js...@fa... wrote: > > On Wed, 29 Mar 2006 10:34:08 -0500, "Darren Dale" <dd...@co...> > said: >> On Tuesday 28 March 2006 19:05, you wrote: >>> plotlibrc 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() >> >> Your second script works fine for me. I was able to switch the font in >> the >> postscript file, between Bitstream Vera Sans and Arial, by modifying >> your >> fontDict. I'm using svn mpl on linux, but I dont think anything has >> changed >> since 0.87.2 that would effect the results. >> >> Are there any Mac users with a free moment to run his script? >> >> Darren >> > > Darren and Jim: Works for me on 10.4. -Jeff > |