I am trying to create a simple XY scatterplot where each data point is colored based on a categorical variable. I want to add a single regression line for all the dots into a single model, but I cannot figure out how to do it since the code below shows one per category. I don't see an obvious argument to change this in geom_smooth. Any ideas? Thank you!
As I understand the situation, the geoms generally have an argument named inherit.aes with a default value of TRUE. Any settings in the default aes set in ggplot() will be shared in the geom. If you set inherit.aes to FALSE, the geom's aes will be entirely independent.
geom_point(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)