Overlay graphics with ggplot2?

Asked

Viewed 469 times

1

I am learning to use ggplot2 and would like to make a chart and then overlay a point on it. For example:

set.seed(1)

a = data.frame(X1 = rnorm(3), X2 = rnorm(3))

g <- ggplot(a, aes(x = X1, y = X2), colour="black", fill = NA) + geom_polygon()

ponto = c(-.4, .5)

Thanks in advance!

1 answer

1


A Quick-and-Dirty solution would be to create the point with a data.frame.

g + geom_point(data=data.frame(x=-0.4, y=0.5), aes(x=x, y=y), colour='white')

Browser other questions tagged

You are not signed in. Login or sign up in order to post.