[R] : bquote inside legend() - TANKS!

stephen sefick ssefick at gmail.com
Mon Aug 11 19:09:34 CEST 2008


entities must not be multiplied beyond necessity

On Mon, Aug 11, 2008 at 1:05 PM, Monica Pisica <pisicandru at hotmail.com> wrote:
>
> Hi,
>
> Thanks so much, i even don't know why i felt the compulsion to complicate myself with the legend and bquote ;-) Fancy code is not necessarily the best - i may say!
>
> Again, thanks,
>
> Monica
>
>> Date: Mon, 11 Aug 2008 12:49:04 -0400
>> From: ssefick at gmail.com
>> To: pisicandru at hotmail.com
>> Subject: Re: [R] : bquote inside legend()
>> CC: r-help at r-project.org
>>
>> #Code begin:
>> # -------------------
>> a = 2 # result of a function for example
>> plot(1:10, a*(1:10))
>>
>> #here you go
>> legend(1, 20, paste("value", "=" , a, sep=" "), title="Legend" ,bty = 'n')
>>
>> val <- substitute("value" ==.(a), list(a = a))
>> legend(6, 5, do.call("expression",list("Legend", val)), bty = 'n')
>>
>> # -------------------
>> # Code end
>>
>> On Mon, Aug 11, 2008 at 12:30 PM, Monica Pisica  wrote:
>>>
>>> Hi,
>>>
>>> I have a graph and I would like to write some values inside the legend that were saved in a variable. Please revise the code below in which I've wrote 2 different legends, but I am not happy with either of them. What I want is a legend with tile "Legend" and underneath a line with a name and a value like that: value = 2.
>>>
>>> #Code begin:
>>> # -------------------
>>> a = 2 # result of a function for example
>>> plot(1:10, a*(1:10))
>>>
>>> legend(1, 20, c("Legend", bquote(value ==.(a))), bty = 'n')
>>>
>>> val <- substitute("value" ==.(a), list(a = a))
>>> legend(6, 5, do.call("expression",list("Legend", val)), bty = 'n')
>>>
>>> # -------------------
>>> # Code end
>>>
>>> In the first legend I don't like that value == 2 instead of value = 2, in the second legend, obviously I don't like the period and the brackets around the value of a.
>>>
>>> Thanks for any help,
>>>
>>> Monica
>>>
>>>
>>> _________________________________________________________________
>>>
>>>
>>> LM_WLYIA_whichathlete_us
>>> ______________________________________________
>>> 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.
>>>
>>
>>
>>
>> --
>> Let's not spend our time and resources thinking about things that are
>> so little or so large that all they really do for us is puff us up and
>> make us feel like gods. We are mammals, and have not exhausted the
>> annoying little problems of being mammals.
>>
>> -K. Mullis
>
> _________________________________________________________________
> Get Windows Live and get whatever you need, wherever you are.  Start here.
> http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home_082008



-- 
Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

	-K. Mullis



More information about the R-help mailing list