I made this graph using the ggplot 2 function but now I want to put 2 different colours for each curve and its air to distinguish the female curve from the male curve in the same graph. Could you help me, please?
I have added what my histogram looks like to give someone an idea on what I am working with, also here is my code thus far, thank you in advance.
# Required packages
library(ggplot2)
combined_data <- rbind(data_females, data_males)
cols <- c("#EEA9B8", "#6CA6CD")
ggplot(combined_data, aes(x = rotation_angle_good, y = rotation_time_sec, color = sex)) +
geom_point(size = 0.9, shape = 19, aes(color = sex)) + # Spécifiez la couleur ici
geom_smooth(method = "lm", se = TRUE, aes(group = sex), color = "#5F90BB", fill = "#5F90BB") +
labs(x = "Starting Angle (Degree)", y = "Rotation Time (sec)") +
scale_color_manual(values = cols)+
scale_fill_manual(values = c("female" = "#EEA9B8", "male" = "#6CA6CD")) +
coord_cartesian(ylim = c(0, 2.5)) +
theme_minimal()```
New contributor
Lou Cauchi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.