On Fri, Mar 26, 2010 at 16:05, Brad Eck <brad.eck at mail.utexas.edu>
wrote:>
> ? When I try to add the following annotation to a plot the entries are
plotted
> ? one on top of the other. ?I'm trying to get something that looks like
" eta
> ? = ?0.2 ?" ?where the Greek letter is used on the plot. ?I realize
that
> ? expression( eta == 0.2) is one solution, but ultimately I'd like to
use this
> ? in a legend that uses a loop to fill the entries so I don't want the
0.2
> ? entered manually.
> ? val <- 0.2
> ? plot( c(0,1), c(0,1) )
> ? text( ?0.5, 0.5, c( expression( eta ), paste( ' = ', val ) ) )
> ? Thanks,
> ? Brad
> ______________________________________________
> 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.
>
Your text is a vector of length 2 and you are plotting each element
over the same x,y coordinates, hence the overlap. You could either
add a second x-coordinate to spread things out:
text( c(0.5,0.55), 0.5, c( expression( eta ), paste( ' = ', val ) ) )
or use bquote:
text( 0.5, 0.5, bquote(eta == .(val) ) )
Hope that helps