4

I want to add an R^2 value to my plot. I passed the label to geom_text() as follows;

 geom_text(aes(x,y,label=caption),parse=T,
        data.frame(x=-2,y=80,caption=("R^2=0.43"))))

but it plots as =(R^2,0.43). Any ideas?

1
  • How do I add a separate line after the R^2=0.43, e.g. p=0.763? Commented Aug 24, 2011 at 21:33

1 Answer 1

8

You want your caption to be "R^2==0.43". Look at the help page for plotmath. There it shows that == gives you equals.

EDIT:

To answer the comment after the question, you can use atop in the expression. "atop(R^2==0.43,p==0.763)" This works for two lines, but not more.

Sign up to request clarification or add additional context in comments.

1 Comment

Great,thanks! Just getting familiar with plotmath. Sorry if the question seemed stupid

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.