Adding text annotation to a clustering scatter plot (tSNE)
Adding text annotation to a clustering scatter plot (tSNE) I have XY data (a 2D tSNE embedding of high dimensional data) which I'd like to scatter plot . The data are assigned to several cluster s, so I'd like to color code the points by cluster and then add a single label for each cluster , that has the same color coding as the cluster s, and is located outside (as much as possible) from the cluster 's points. XY tSNE scatter plot cluster cluster cluster cluster cluster Any idea how to do this using R in either ggplot2 and ggrepel or plotly ? R ggplot2 ggrepel plotly Here's the example data (the XY coordinates and cluster assignments are in df and the labels in label.df ) and the ggplot2 part of it: XY cluster df label.df ggplot2 library(dplyr) library(ggplot2) set.seed(1) df <- do.call(rbind,lapply(seq(1,20,4),function(i) data.frame(x=rnorm(50,mean=i,sd=1),y=rnorm(50,mean=i,sd=1),cluster=i))) df$cluster <- factor(df$cluster) label.df <- data.frame(c...