[R] color of math annotation in legend
Peter Ehlers
ehlers at ucalgary.ca
Thu Jul 28 17:26:41 CEST 2011
On 2011-07-28 01:11, Zhongyi Yuan wrote:
> Thank you Tyler.
> I thought the problem was due to the use of expression(...).
Also note that you can simplify your legend text:
c(expression(alpha == 1), expression(alpha == 2))
In general, I find that paste() is overused in plotmath.
Peter Ehlers
>
> Best,
> Zhongyi
>
> On Thu, Jul 28, 2011 at 2:49 AM, Tyler Rinker<tyler_rinker at hotmail.com>wrote:
>
>> Use the text.col argument as below
>> ?legend
>>
>>
>> x=y=1:100
>> z=seq(0.5,50,by=0.5)
>> plot(x,y,type='l',col='black')
>> lines(x,z,col='red')
>> legend('topleft',c(expression(paste(alpha," = ", 1)),
>> expression(paste(alpha," = ", 2))),text.col=c("black","red"))
>>
>>
>>
>>
>> > Date: Thu, 28 Jul 2011 02:32:04 -0500
>>> From: zhongyi-yuan at uiowa.edu
>>> To: r-help at r-project.org
>>> Subject: [R] color of math annotation in legend
>>
>>>
>>> Dear useRs,
>>>
>>> Can someone help me to adjust the color of math annotation in a legend?
>> The
>>> following code gives me a black "alpha = 2".
>>>
>>> x=y=1:100
>>> z=seq(0.5,50,by=0.5)
>>> plot(x,y,type='l',col='black')
>>> lines(x,z,col='red')
>>> legend('topleft',c(expression(paste(alpha," = ", 1)),
>>> expression(paste(alpha," = ", 2))),col=c('black','red'))
>>>
>>> Is it possible to make it red? Thanks in advance for your help.
>>>
>>> Best,
>>> Zhongyi Yuan
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> 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.
>>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
More information about the R-help
mailing list