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.

Reply via email to