[R] legend font
    Duncan Murdoch 
    murdoch at stats.uwo.ca
       
    Wed Feb 14 20:40:47 CET 2007
    
    
  
On 2/14/2007 1:32 PM, Tyler Smith wrote:
> Hi,
> 
> I'd like to make the text in my legends italic, but I can't figure out
> how to do so. font=3 doesn't work. Googling brings up the possibility
> of expression(italic()), which produces italics, but I can't get this
> to work with my label data, which is a vector of strings:
> 
>   legend(locator(1), legend = levels(factor(label.vector)),
>          col = plotting.colours, pch =plotsym.bw, cex = 0.7 )
> 
> 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)
Duncan Murdoch
    
    
More information about the R-help
mailing list