help adding annotation to ggplot

split from Annotate ggplot2 with regression equation and r squared


having a problem with adding R2, p value and slope on my scarter plot in rggplot. my dependent variable is groundwater level and rainfall is my independent variable. can you please guide me what to do. i need help urgently

Do you have a reprex that folks can use as a starting point? (FAQ: What's a reproducible example (`reprex`) and how do I do one?)

@EconomiCurtis thank you for your response. below is what I have performed to plot a scatter plot but I am unable to add the R2, slope and p-value. I need help to do that.

ggplot(wcr,aes(x=Rainfall,y=Groundwater.Level))+geom_point(alpha=0.6)+stat_smooth(method="lm",col="red",se=FALSE)

@EconomiCurtis thank you for your response. below is what I have performed to plot a scatter plot but I am unable to add the R2, slope and p-value. I need help to do that.

wcr <- read.csv("C:/Users/musa/Desktop/data complete/REGRESSION/wcr.csv")
View(wcr)
attach(wcr)
library(ggplot2)
ggplot(wcr,aes(x=Rainfall,y=Groundwater.Level))+geom_point(alpha=0.6)+stat_smooth(method="lm",col="red",se=FALSE)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.