Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R^2 as option in stat_cor() #32

Closed
philament opened this issue Sep 15, 2017 · 3 comments
Closed

R^2 as option in stat_cor() #32

philament opened this issue Sep 15, 2017 · 3 comments

Comments

@philament
Copy link

I like the simplicity of quickly adding the correlation coefficient and p-value to a scatter plot produced with ggscatter(). It would be nice to be able to select the R^2 value instead of r as a method in stat_cor() .

@mlebeur
Copy link

mlebeur commented Jan 24, 2018

I am totally agree !

kassambara added a commit that referenced this issue Aug 11, 2018
@kassambara
Copy link
Owner

Now, R2 is supported.

library("ggpubr")
# Default output
ggscatter(mtcars, x = "wt", y = "mpg", add = "reg.line") +
  stat_cor(label.x = 3)

rplot39

# Use R2 instead of R
ggscatter(mtcars, x = "wt", y = "mpg", add = "reg.line") +
  stat_cor(
    aes(label = paste(..rr.label.., ..p.label.., sep = "~`,`~")), 
    label.x = 3
    )

rplot40

@lucygarner
Copy link

Is it possible to achieve this but with the R2 and p value on separate lines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants