I have created a plot of the Sepal.Length and the Sepal.Width (using the iris dataset) with ggplot2.
ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, col = Species)) + geom_point()
Works fine but now I would like to add a seperate point to the graph with a blue color. So for example:
df = data.frame(Sepal.Width = 5.6, Sepal.Length = 3.9)
Any thoughts on how I can accomplish this?
Add another layer:
ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, col = Species)) +
geom_point() +
geom_point(aes(x=5.6, y=3.9), colour="blue")
library('ggplot2')
df = data.frame(Sepal.Width = 5.6, Sepal.Length = 3.9)
ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, col = Species)) +
geom_point() +
geom_point(data = df, col = 'blue')
Using annotate:
ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, col = Species)) +
geom_point() +
annotate("point", x = 5.6, y = 3.9, colour = "blue")