On 2/14/2007 3:12 PM, Tyler Smith wrote:
> On Wed, Feb 14, 2007 at 02:40:47PM -0500, Duncan Murdoch wrote:
>> On 2/14/2007 1:32 PM, Tyler Smith wrote:
>> >Hi,
>> >
>> >I'd like to make the text in my legends italic, 
> 
> ...
> 
>> >How can I do this?
>> 
>> This should work:
>> 
>> plot(1,1)
>> savefont <- par(font=3)
>> legend("topright", legend=c('Label 1', 'Label 2'), pch=1:2)
>> par(savefont)
>> 
> 
> Thanks! I don't understand it yet, but it does indeed work.

The idea is that the first par() command changes the default font for 
everything. (The legend() function doesn't pass any font request down to 
the graphics system, it just uses the default font.)  It also returns 
the old font setting and I saved it in "savefont".

The second par() call restores the old font setting.

Duncan Murdoch

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to