Description Usage Arguments Details Value
Overlay centroids via k-means or graph-based clustering
Overylay k-means centroids onto an xy scatter
1 2 3 4 5 | overlay_knn_centroids(x, y, indices, ...)
overlay_snn_centroids(x, y, indices, ...)
overlay_kmeans_centroids(x, y, num_centers, ...)
|
x |
numeric vectors to produce segments from |
y |
numeric vectors to produce segments from |
indices |
a neighborSet index matrix |
... |
additional arguments to pass to ggplot2::geom_segment |
num_centers |
the number of centroids to estimate |
The nearest neighbor centroids functions
automatically estimate centroids from an indices matrix
representing a nearest neighbor graph via a community detection
algorithm (louvain) from the igraph package.
The smaller the value of ncol(indices)
the more centroids
there will be. The kmeans method returns the centroids from
run stats::kmeans with the user suppplied number of centers.
a ggplot2::geom_point layer
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.