I have a scatter plot with a regression line and would like to fill the space below the regression line grey.
#my data
p2 = as.data.frame(cbind(Population = c(1432132, 2582830,1628701, 2278906,476179), Borough =c("BRONX", "BROOKLYN", "MANHATTEN", "QUEENS", "STATEN ISLAND"), count = c(341, 1427, 1092, 700, 39)))
p2$Population = as.numeric(as.character(p2$Population))
p2$count = as.numeric(as.character(p2$count))
fit = lm(p2$count ~ p2$Population , data = p2)
#the plot
ggplot(p2, aes(x=Population, y=count, color = Borough)) +
geom_point() +
geom_text(label=p2$Borough, hjust = -0.1) +
geom_smooth(color = "black", method='lm', formula= y~x, se = FALSE) +
theme_classic()
So far I have tried using geom_area(aes(fill=)) but instead of using the regression as data it connects my data points to the regression line. Is there anyway to specify to fill under the regression line instead of the data?