Work on a space of morula
birthday <- function(
X,
Y,
VARx,
VARy,
Ns) {
RES <- vector(mode="list", length(X))
r=runif(5000)
g=runif(5000)
b=runif(5000)
tr=rep(1,5000)
rgb=as.data.frame( cbind(r,g,b,tr) )
rgb$color=rgb(rgb[,c(1,2,3,4)])
for(i in seq(RES)){
RES[[i]]$x = rnorm(Ns[i],X[i],VARx[i])
RES[[i]]$y = rnorm(Ns[i],Y[i],VARy[i])
RES[[i]]$distance = sqrt((RES[[i]]$x-X[i])^2 + (RES[[i]]$y-Y[i])^2)
dmax = max(RES[[i]]$distance)
RES[[i]]$size = dmax/40*exp(-RES[[i]]$distance/dmax*2)
}
minLIM = min(unlist(RES))
maxLIM = max(unlist(RES))
par(mar=c(0,0,0,0), bg=1)
plot(1, type="n", xlim=c(minLIM,maxLIM), ylim=c(minLIM,maxLIM))
for(i in seq(RES)){
symbols(RES[[i]]$x, RES[[i]]$y,
circles = RES[[i]]$size, bg = rgb$color, fg=rgb$color,
inches = FALSE, xaxt='n', yaxt='n', add=TRUE)
}
return (c(minLIM,maxLIM))
}
birthday(c(100,1000,-100,2000,1500,0), c(100,1000,1200,0,1500,2500),
c(400,100,100,300,200,100),c(200,100,100,300,200,300),
c(5000,750,1200,3000,2000,1000))