I have been trying to visualise my data using Rtsne however I can't get my legend to appear next to my plot and I can't get the points to fill in. I have been trying various code alterations including changing the location of the legend manually:
tsne <- Rtsne(featureMatrix, perplexity=40, theta=0.5, dims=2, col=factor(conds), fill=factor(conds)+
geom_point(size=4)+
labs(title= "tSNE: PC1 vs PC2" ,x=paste0("PC1(",pca_data_perc[1],"%)"),y=paste0("PC2 (",pca_data_perc[2],"%)")) +
theme_bw() +
theme(plot.title = element_text(hjust = 0.5)) +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))+
geom_text_repel(aes(label=type$Sample), point.padding = 0.5))
set.seed(1)
plot(tsne$Y, col=factor(conds))
legend(x = 6,y = 4,
legend = c("Control","T/P", "T/P_Alk","T/P_Imat","T/P_Combo"),
fill = 1:5,
border = "black")
When I just place the legend in the x = "topright"
When I have moved the legend manually: