Question

Hey I want to draw several circles in R with different radius.

I did this with 'plotrix' and draw.circle:

draw.circle (0,0,1)
draw.circle (0,0,1.5)
draw.circle (0,0,2)
...

Do you know a faster and smarter way to do that?

Was it helpful?

Solution

draw.circle seems to accept a vector of inputs, so use whatever function is convenient to make your sequence of inputs and pass that to the function.

plot(0,0,type = "n", xlim = c(-10,10), ylim = c(-10,10))
draw.circle (0,0,seq(0,4,.5))

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top