Mien
Mien

Reputation: 149

How can I make my plotted circle smaller in R?

When I try to plot a circle using RStudio, I only see part of the circle. This happens when I use draw.circle from the plotrix package and when I use grid.circle from the grid package.

This is what I see:
enter image description here

I just want to have a normal circle. How can I do this?

Upvotes: 2

Views: 636

Answers (2)

joran
joran

Reputation: 173577

Just a shot in the dark here.

draw.circle only adds to the current plot. If the result cuts off the circle, the reason is that you didn't create a plotting region with room to view the circle.

Compare:

plot(-3:3,-3:3,type = "n")
draw.circle(1,1,1)

with this:

plot(0:1,0:1,type = "n")
draw.circle(1,1,1)

Upvotes: 3

Reuben L.
Reuben L.

Reputation: 2859

Try:

draw.circle(0.1,0.1,0.1)

Idea is that the coordinates start from the left bottom corner where the axes meet. If you set like 1,1,1 the radius would exceed the boundaries and you would get a quarter circle.

Upvotes: 1

Related Questions