Alex Rivera | Logout

Draw a circle with ggplot2

Asked 2011-07-28T16:58:29.880
77

Maybe it is a silly question, but I couldn't find the answer in the handbook of ggplot2 nor with "aunt" google...

How do I plot a circle with ggplot2 as an additional layer if I have a middle point and a diameter? Thanks for your help.

Edit
Report

1 Answer

14

with ggplot2 >= 0.9 you can also do

library(grid)
qplot(1:10, 1:10, geom="blank") +
  annotation_custom(grob=circleGrob(r=unit(1,"npc")), xmin=2, xmax=4, ymin=4, ymax=6)
answered 2012-03-23T22:06:35.783

Your Answer