How to change font size on stat_poly_eq in ggplot2 R

Viewed 3514

I have a ggplot stored in say p and wish to add a poly_stat_eq layer to display the equation of the curve. I want to change to font size of the text but I'm unable to find a documentation on how to achieve it

p + 
  stat_poly_eq(formula = y ~ x, 
               aes(label = paste(..eq.label.., ..rr.label.., sep = "~~~")),
               label.x = 4, label.y = -5, parse = TRUE) 
1 Answers

You can just set size = some real number. In your case this would look like

 p + 
  stat_poly_eq(formula = y ~ x, 
               aes(label = paste(..eq.label.., ..rr.label.., sep = "~~~")),
               label.x = 4, label.y = -5, parse = TRUE, size = 2.4) 

Just change the number after size = to whatever you want. The ggpmisc additional examples page is a good place to look over as well. You can find that here. I hope this helps.

Related