im relatively new with plotly and it looks quite exciting !! recently, i was trying through Rstudio and from package ggplot2,
to create an interactive pca plot (regarding some gene expression data) using as final function the ggplotly function. In detail, part of my code:
mat <- exprs(eset.4) # one expression set for input
pca <- prcomp(t(mat), scale=TRUE)
pcvar = pca$sdev^2/sum(pca$sdev^2)*100
tot <- cbind(pca$x,phenotype_dat) # which renders the variables info
p <- ggplot(tot, aes(PC1,PC2, colour=Disease,shape=Study)
p <- p + geom_point(size=3) +
xlab(paste0(“PC1: “,round(pcvar,2),”% variance”)) +
ylab(paste0(“PC2: “,round(pcvar,2),”% variance”))
The only problem is that the legend labels in the output image are not clear and well separated !!
Is there a way to fix this in the above implementation with ggplotly ?
Thank you in advance,