[R] changing font to italic for one entry in legend()

Vikram Chhatre crypticlineage at gmail.com
Fri Jun 8 02:59:35 CEST 2012


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/



More information about the R-help mailing list