I'm a beginner learner with R. I've been attempting to combine legends for so long and just can't seem to do it.
Data works fine and is accurate and plotted properly. Except colour and shape aren't combined in one legend but in separate legends.
Here's my code:
ggp1 <- ggplot(data, aes(x = Year)) +
geom_point(aes(y = Temperature, colour = "Africa", shape = "Africa")) +
geom_point(aes(y = y2, colour = "Asia", shape = "Asia")) +
geom_point(aes(y = y3, colour = "Europe", shape = "Europe")) +
geom_point(aes(y = y4, colour = "Australia", shape = "Australia"))
Edit: Here's the data:
data <- data.frame(Year = df1$Year,
Temperature = df1$Temperature.Africa,
y2 = df1$Temperature.Asia,
y3 = df1$Temperature.Europe,
y4 = df1$Temperature.Australia)
Please help before I go crazy.