1

I am trying to re-create a PCA plot that I've made previously here, but have since lost the code which I used to make it: https://i.stack.imgur.com/bMh6m.jpg

In this plot above I was able to group individuals by both their "Location" (different shapes) as well as a numeric value, DOY, associated with each individual and ranging from 100 to 300.

I am trying again and having difficulty. My data is formatted such that the first column is the location (which I would like to group the individuals by shape) and the second column is a number, DOY (which I'd like to colour the individuals by):

Location <- Data[,1]
DOY <- as.numeric(Data[,2])
Data.PCA <- prcomp(Data[,3:11], Center = TRUE, Scale = TRUE)
g <- ggbiplot(Data.PCA, obs.scale = 1, var.scale = 1, 
              groups = Location, ellipse = TRUE)
g <- g + aes(scale_colour_continuous = DOY)
print(g)

However when I do this, I recieve an error:

Error: Aesthetics must be either length 1 or the same as the data (9): x, y, xend, yend, scale_colour_continuous

demongolem
  • 9,474
  • 36
  • 90
  • 105
MattQ
  • 43
  • 4

0 Answers0