#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 <[EMAIL PROTECTED]> 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@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 ______________________________________________ R-help@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.