Sorry -- I forgot to mention that you need to put the verbose.level
argument in your matplotlibrc file -- it can't be changed once
matplotlib has been imported.
Thanks,
Mike
David M. Kaplan wrote:
> Hi,
>
> I gave this a shot, but it didn't print anything out. Attached is an
> example of a plot where the fonts don't match.
>
>
> In [4]: rcParams['verbose.level']='debug-annoying'
>
> In [5]: rcParams['mathtext.fontset'] = 'stix'
>
> In [6]: rcParams['font.family'] = 'serif'
>
> In [7]: plot(arange(10))
> Out[7]: [<matplotlib.lines.Line2D object at 0x92b162c>]
>
> In [8]: text(1,7,r'$1 \alpha$')
> Out[8]: <matplotlib.text.Text object at 0x8f047cc>
>
> In [9]: text(1,3,'1 alpha')
> Out[9]: <matplotlib.text.Text object at 0x92c4c0c>
>
> In [10]: savefig('test.eps')
>
>
> Thanks,
> David
>
>
> On Fri, 2008-07-11 at 09:35 -0400, Michael Droettboom wrote:
>
>> This works for me. Could you set the rcParam verbose.level to
>> debug-annoying and send the output -- that will print some information
>> about where it's looking for fonts and what it can and can not find.
>>
>> Cheers,
>> Mike
>>
>> David M. Kaplan wrote:
>>
>>> Hi,
>>>
>>> Thanks for the suggestions. I have stopped using the usetex option. To
>>> make math and normal text match, I tried the following:
>>>
>>> rcParams['font.family'] = 'serif'
>>> rcParams['mathtext.fontset'] = 'stix'
>>>
>>> This didn't make them match - normal text looked to me like it was still
>>> sans-serif, while mathtext was with serif. Is there something else I
>>> should be doing to make this happen?
>>>
>>> Thanks again for your help.
>>>
>>> Cheers,
>>> David
>>>
>>>
>>> On Thu, 2008-07-10 at 11:52 -0400, Darren Dale wrote:
>>>
>>>
>>>> Hi David,
>>>>
>>>> On Thursday 10 July 2008 11:15:37 am David M. Kaplan wrote:
>>>>
>>>>
>>>>> 2) I have noticed that the font used for the xticklabels and the font
>>>>> used for the xlabel and contour labels appears to be different (example
>>>>> attached). One appears to be serif and the other sans-serif. This
>>>>> seems to be due to using tex for text rendering. I am not sure if this
>>>>> also occurred before the update, but I didn't notice it previously.
>>>>>
>>>>>
>>>> It has always been this way. We tried a workaround once a couple years
>>>> back
>>>> and it turned into a real mess.
>>>>
>>>>
>>>>
>>>>> Looking at the properties of the different text objects, it isn't
>>>>> apparent that there should be a difference - both have font properties
>>>>> that indicate sans-serif, but the text of tick labels appears to be
>>>>> surrounded by $'s forcing it through the text parser, while that of the
>>>>> contour labels is not. Is this difference normal or expected? Is there
>>>>> a way around this? In particular, I would like to use sans-serif for
>>>>> everything - is this possible while still using tex?
>>>>>
>>>>>
>>>> I think there is a package, sansmath or something like that, that will
>>>> allow
>>>> latex to use sans-serif fonts in math mode. You could try adding it to the
>>>> text.latex.preamble rc setting, but that option is not officially
>>>> supported.
>>>>
>>>> If you don't like the limitations of latex, you might want to turning off
>>>> usetex and just use matplotlibs mathtext, which recently got a significant
>>>> rewrite and is now quite capable thanks to Mike Droettboom. Here's some
>>>> documentation too:
>>>> http://matplotlib.sourceforge.net/doc/html/users/mathtext.html
>>>>
>>>> Darren
>>>>
>>>>
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users