I am working on infrared spectral data using the “Chemospec” package. I performed a PCA and now want to visualize the results, the function “plotScores” plots the PCA scores. I am trying to move the position of the legend but it stays in the top right corner.The function “plotScores” uses ggplot2 to visualize the data so I tried different ggplot position assignments but nothing changes.
This is the code I am using:
p <- plotScores(data_sample, pca, pcs = c(1,2), ellipse = "no", tol = 0.01, legendPos = "bottom")
p <- p & ggtitle(myt)
p <- p + theme_gray()
p <- p + theme(legend.position = "bottom")
p
Has anyone else encountered this problem?
Thanks in adavance!
Tetrao is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.