rggplot2fontscorrelationpearson-correlation

Increasing font size of auto-generated R and p-value


This's a rather straightforward question where I'd like to increase the font size of the automatically generated R and p-value for my correlation plot via ggscatter. I've tried using cex but doesn't seems to work. Would appreciate any help on this, thanks.

My plot

1

My script

cpsbs <- read_csv("cpsbs.csv")
View(cpsbs)



psbs600 <-ggscatter(cpsbs, x = "npq600", y = "rd", 
          add = "reg.line", conf.int = TRUE, 
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Max NPQ (600s)", ylab = "PsbS relative density")+ theme(text = element_text(size = 18)) 

My data drame

data.frame(cpsbs)
  id  gen line   npq600  npq900        rd    delcq
1  1 PsbS L1.1 3.053330 0.19666 1.2211420 4.862588
2  2 PsbS L1.2 3.133333 0.17000 1.5918041 5.470889
3  3 PsbS L1.3 2.756667 0.17000 2.1668718 4.773088
4  4 PsbS L1.4 3.160000 0.21000 2.6198157 3.809744
5  5 PsbS L1.5 3.306667 0.20700 1.5571007 4.169890
6  6 PsbS L1.6 0.480000 0.33000 0.0000000 0.000000
7  7 PsbS L1.7 2.960000 0.20000 1.0520551 4.485594
8  8 PsbS L1.8 2.946667 0.21000 0.4648043 3.900248
9  9 PsbS L1.9 2.986667 0.18000 1.9454836 3.782560

Solution

  • I think you're looking for the cor.coef.size argument:

    ggscatter(cpsbs, x = "npq600", y = "rd", 
              add = "reg.line", conf.int = TRUE, 
              cor.coef = TRUE, cor.method = "pearson",
              cor.coef.size = 10,
              xlab = "Max NPQ (600s)", ylab = "PsbS relative density")+ 
      theme(text = element_text(size = 18))
    

    enter image description here