Vikram Chhatre
2012-Jun-08 00:27 UTC
[R] changing font to italic for one entry in legend()
Hello, I need to change the font for one of the items (C. elegans) in my legend to italic. Can someone suggest how to accomplish this? legend('bottomright', bty='n', c('C. elegans range', 'Study area'), cex=0.8, fill=c('light gray', 'white'), border=c('black','black')) I tried using lab.font=c(1,3) but R ignored and did not write the legend at all. Any advice would be great. Thanks. V
Vikram Chhatre
2012-Jun-08 00:59 UTC
[R] changing font to italic for one entry in legend()
Thanks Paul. That worked beautifully. V On Thu, Jun 7, 2012 at 7:46 PM, Paul Murrell <p.murrell at auckland.ac.nz> wrote:> Hi > > > On 8/06/2012 12:27 p.m., Vikram Chhatre wrote: >> >> Hello, >> >> I need to change the font for one of the items (C. elegans) in my >> legend to italic. ?Can someone suggest how to accomplish this? >> >> legend('bottomright', bty='n', c('C. elegans range', 'Study area'), >> cex=0.8, fill=c('light gray', 'white'), border=c('black','black')) >> >> I tried using lab.font=c(1,3) but R ignored and did not write the legend >> at all. > > > The help page suggests that text.font=c(3, 1) should work. > > If you just want the "C. elegans" to be italic, try something like ... > > > legend('bottomright', bty='n', > ? ? ? expression(italic('C. elegans')*' range', 'Study area'), > > ? ? ? cex=0.8, fill=c('light gray', 'white'), > ? ? ? border=c('black','black')) > > Paul > >> Any advice would be great. >> >> Thanks. >> V >> >> ______________________________________________ >> R-help at r-project.org 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. > > > -- > Dr Paul Murrell > Department of Statistics > The University of Auckland > Private Bag 92019 > Auckland > New Zealand > 64 9 3737599 x85392 > paul at stat.auckland.ac.nz > http://www.stat.auckland.ac.nz/~paul/
HI, Have you tried italic()? legend(expression(italic("Study area")). It is untested as I am not in front of my linux system. A.K. legend(expression(italic("Expression species") ----- Original Message ----- From: Vikram Chhatre <crypticlineage at gmail.com> To: r-help at r-project.org Cc: Sent: Thursday, June 7, 2012 8:27 PM Subject: [R] changing font to italic for one entry in legend() Hello, I need to change the font for one of the items (C. elegans) in my legend to italic.? Can someone suggest how to accomplish this? legend('bottomright', bty='n', c('C. elegans range', 'Study area'), cex=0.8, fill=c('light gray', 'white'), border=c('black','black')) I tried using lab.font=c(1,3) but R ignored and did not write the legend at all. Any advice would be great. Thanks. V ______________________________________________ R-help at r-project.org 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.