I want to increase the font size of autogenerated r2 and p value. I used the code like
+ theme(text = element_text(size = 18)) but it did not make any changes?
The code used are given below
# Load data
data("mtcars")
df <- mtcars
# Convert cyl as a grouping variable
df$cyl <- as.factor(df$cyl)
ggscatter(df, x = "wt", y = "mpg",
add = "reg.line",
conf.int = TRUE,
color = "cyl", palette = "jco",
shape = "cyl"
)+
stat_cor(aes(color = cyl), label.x = 3) +
theme(text = element_text(size = 18))
stat_corusesgeom_text. The documentation inhelp("geom_text")tells you that it "understands" thesizeaesthetic.