CodeGuy
CodeGuy

Reputation: 28905

R plot - make a big circle at a point

How can I make a point that is a big, NOT colored in circle?

x0 and y0 are just lists with 1 value.

So this just plots one value:

points(x=x0,y=y0,col="green",pch=16)

But the circle is sort of small, and it's colored in.

Upvotes: 3

Views: 9725

Answers (3)

Paolo
Paolo

Reputation: 2815

The package shape contains a collection of functions for plotting all kind of graphical shapes ( see vignette("shape") ). In your case:

install.packages("shape")
require("shape")
emptyplot(c(0, 1))
plotcircle(mid = c(0.5, 0.5), r = 0.25)

enter image description here

Upvotes: 3

Gavin Simpson
Gavin Simpson

Reputation: 174823

Depending how big you the circles you want, you could also consider the symbols() function.

## from ?symbols
N <- nrow(trees)
with(trees, {
## Girth is diameter in inches
symbols(Height, Volume, circles = Girth/24, inches = FALSE,
        main = "Trees' Girth") # xlab and ylab automatically
})

plot showing use of symbols()

Upvotes: 6

joran
joran

Reputation: 173577

To make the single plotting character larger, use cex, as in:

points(x = x0, y = y0, col = "green", pch = 16, cex = 10)

Please read (even though it's kind of tedious) ?par for base graphics options.

EDIT

I suppose I should add (even though I agree this question is mostly a duplicate) that the second part of your question simply requires a different value for pch. Sounds like pch = 1 is what you want, but you can see lots of options via example("points").

Upvotes: 6

Related Questions