I have this boxplots graph, and then I am trying to plot 2 different points on top of it, of different colors, so that the user can see where they fall on the boxplot, plus compare them to each other. The problem is, i want the legend to show two dots with corresponding colors, and their IDs. Instead, the legend is showing the boxplot categories/colors. How can i override the legend to show only what i want? Here's my code:
library(datasets)
library(ggplot2)
data(airquality)
airquality$Month <- factor(airquality$Month,
labels = c("May", "Jun", "Jul", "Aug", "Sep"))
airquality$ID <-seq(1:nrow(airquality))
dataPoint <- airquality[11,]
dataPoint2 <- airquality[17,]
plt <- ggplot(airquality, aes(x = Month, y = Ozone, color = Month)) +
geom_boxplot(show.legend=TRUE,outlier.shape = NA) +
geom_point(data = dataPoint, color='darkblue', aes(x = Month, y = Ozone), size = 3,show.legend=TRUE) +
geom_point(data = dataPoint2, color='darkred', aes(x = Month, y = Ozone), size = 3,show.legend=TRUE) +
theme(legend.position = "bottom")
plt