Help with creating ggplot

Hi there!

I would like to ask how can I create specific colour for each data frame. In this code below, I want to illustrate the correlations between utopian thinking and each of the wellbeing subscale (Autonomy, Environmental_Mastery, Personal_Growth, Positive_Relations, Purpose_in_life, Self_acceptance) in Carol Ryff's wellbeing scale. Since i want each subscale to have a specific color for its datapoint but I can only do so with the best fitted lines. I would like to know is there specific argument to help me with that?

Much appreciated.

Here is the code:

UW_long <- recode_UW %>%
select(c(Utopianism, Autonomy, Environmental_Mastery, Personal_Growth, Positive_Relations, Purpose_in_life, Self_acceptance)) %>%
pivot_longer(cols=c(Autonomy, Environmental_Mastery, Personal_Growth, Positive_Relations, Purpose_in_life, Self_acceptance), names_to="wellbeing_subscale", values_to="scores")

#Figure 7
UW_long_corrplot <- UW_long %>%
ggplot(aes(x=Utopianism, y=scores, fill=wellbeing_subscale,show.legend=FALSE)) +
geom_point(show.legend=FALSE) +
facet_wrap(facets = ~ wellbeing_subscale) +
theme_classic() +
#theme(strip.background=element_rect(fill="white")) +
y="Wellbeing scores (Wellbeing subScales)") +
geom_smooth(method = "lm", se = TRUE)

Here is the graph

Hard to answer definitely without a reproducible example since you didn't provide test data, but I think you'll get the desired result by using the aesthetic color for the geom_point:

ggplot(aes(x=Utopianism, y=scores, fill=wellbeing_subscale,show.legend=FALSE)) +
geom_point(aes(color = wellbeing_subscale, show.legend=FALSE) +

The point is that fill applies to surfaces (e.g. the smooth of the fitted line), but color applies to the dots and lines.

Also that means if you gave color in the ggplot() command, it would apply to both the points and the fitted line (which is currently blue).

ggplot(aes(x=Utopianism, y=scores, fill=wellbeing_subscale, color = wellbeing_subscale, show.legend=FALSE)) +