I have a matrix, each data point in this matrix have Binomial variable X1
to Xm
, and a continuous variable Y
.
I used Rtsne()
in R to separate all data points by variable X1
to Xm
. After that, instead of clustering them by k-mean or hcluster
, what I want is to add color on all dots based on their Y
values to see how the dots with different Y
value are separated.
Could anyone tell me how to add color for this purpose?
The following code are used to generate the s-SNE plot and draw the plot:
tsne_model_1 = Rtsne(as.matrix(term_tsne), check_duplicates=FALSE, pca=TRUE, perplexity=10, theta=0.5, dims=2)
d_tsne_1 = as.data.frame(tsne_model_1$Y)
ggplot(d_tsne_1, aes(x=V1, y=V2)) +
geom_point(size=0.25) +
guides(colour=guide_legend(override.aes=list(size=6))) +
xlab("") + ylab("") +
ggtitle("t-SNE of 533 terms") +
theme_light(base_size=20) +
theme(axis.text.x=element_blank(),
axis.text.y=element_blank())
term_tsne is the data matrix I used for t-SNE, colnames(term_tsne) return X1, X2....Xm, Y
If you were to provide the exact commands you use, it would be easier for people to know where you are in terms of the solution and how best they can steer you in the right direction.
Thank you! I added the code to the question.
Please use the code formatting button to make code more legible.