# Create data for multiple plots
x <- 1:5
y1 <- x * x
y2 <- 2 * x
y3 <- x^2 - 3
# Plot the first graph
plot(x, y1, type = "b", col = "blue", pch = 16, main = "Overlaying Graphs",
xlab = "X-axis", ylab = "Y-axis")
# Overlay the second graph
points(x, y2, col = "green", pch = 17)
# Overlay the third graph
lines(x, y3, col = "red", lty = 2)
# Add a legend
legend("topleft", legend = c("y = x^2", "y = 2x", "y = x^2 - 3"),
col = c("blue", "green", "red"), pch = c(16, 17, NA), lty = c(1, 1, 2))