Here is the plot. I want to get rid of the black line of the aperture.
I believe the pictures are pretty self explanatory for understanding what i would like to do. But i really have no idea how to go about this. Any help would be greatly appreciated.
But, i want it to look like the following:
Here is my code:
library(spatstat.data)
library(nlme)
library(rpart)
library(spatstat)
repelled_points <- function(n, r_circle, r_clash) {
container_x <- numeric(n)
container_y <- numeric(n)
j <- i <- 1
while(i <= n)
{
j <- j + 1
if(j == 100 * n) stop("Cannot accommodate the points in given space")
x <- runif(1, -1, 1)
y <- runif(1, -1, 1)
if(x^2 + y^2 > 1) next
if(i > 1) {
dist <- sqrt((x - container_x[seq(i-1)])^2 + (y - container_y[seq(i-1)])^2)
if(any(dist < r_clash)) next
}
container_x[i] <- x
container_y[i] <- y
i <- i + 1
j <- 1
}
`class<-`(list(window = disc(centre = c(0, 0), radius = r_circle),
n = n, x = container_x * r_circle,
y = container_y * r_circle, markformat = "none"), "ppp")
}
dots <- repelled_points(18, 1, 0.35)
plot(dots, type="n")
points(dots$x[1:4], dots$y[1:4], pch=15, col="chartreuse3", cex=6)
points(dots$x[5:8], dots$y[5:8], pch=15, col="chartreuse3", cex=6)
points(dots$x[9:13], dots$y[9:13], pch=17, col="chartreuse", cex=6)
points(dots$x[14:18], dots$y[14:18], pch=17, col="chartreuse", cex=6)
Thank you!
You can plot with lty = 0
plot(dots, type="n", lty = 0)
points(dots$x[1:4], dots$y[1:4], pch=15, col="chartreuse3", cex=6)
points(dots$x[5:8], dots$y[5:8], pch=15, col="chartreuse3", cex=6)
points(dots$x[9:13], dots$y[9:13], pch=17, col="chartreuse", cex=6)
points(dots$x[14:18], dots$y[14:18], pch=17, col="chartreuse", cex=6)