Given a list of edges from the convex or alpha hull, and a list of cluster centers, calculate a point near to each cluster on the outside of the hull.
edges.to.outside <- function ### Given a list of edges from the convex or alpha hull, and a list of ### cluster centers, calculate a point near to each cluster on the ### outside of the hull. (edges,centers,debug=FALSE,...){ if(debug){ with(centers,grid.points(x,y,pch="+",default.units="cm")) with(edges,grid.segments(x1,y1,x2,y2,default.units="cm")) } closepts <- gapply(centers,project.onto.segments,edges,debug=debug,...) closepts$vjust <- ifelse(closepts$y-centers$y>0,0,1) closepts$hjust <- ifelse(closepts$x-centers$x>0,0,1) r <- apply.method("big.boxes",closepts) r$x <- (r$right-r$left)/2+r$left r$y <- (r$top-r$bottom)/2+r$bottom r$hjust <- 0.5 r$vjust <- 0.5 r }
Please contact Toby Dylan Hocking if you are using directlabels or have ideas to contribute, thanks! |
Documentation website generated from source code version 2021.2.24 (git revision bb6db07 Mon, 14 Jun 2021 22:38:45 +0530) using inlinedocs. |
validate |