View source: R/Visualizations_Network.R
plot_knn_labels | R Documentation |
This function takes a dataframe that contains x and y coordinates and a label that defines the classes and makes a plot of the k-nearest neighbors graph using Euclidean distance and the cover tree algorithm.
plot_knn_labels(
df,
k = 1,
alpha = 0.7,
algo = c("kd_tree", "cover_tree", "CR", "brute")
)
df |
A dataframe with x and y coordinates and a label column defining the classes. |
k |
An integer that defines the number of nearest neighbors to consider. Default is 1. |
A plot of the k-nearest neighbors graph using ggplot2.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.