ggbiplot returning a blank red column

69 Views Asked by At

I have a microarray of 47,303 probes and 6 time points of treatment of samples.

They are in a large matrix:

dim(microarray)

47303 6

I've done the following:

pca <- prcomp(x = t(microarray), scale. = T, center = T)

Using ggplot2 I'm able to visualise the PCA with the following code:

pca.data <- data.frame(micro_9a = rownames(pca$x),
                       X = pca$x[,1],
                       Y = pca$x[,2])

colnames(pca.data) <- c("Induction",
                        "X",
                        "Y")

ggplot(data = pca.data,
       aes(x = X, y = Y)) +
  geom_text(label = pca.data$Induction) +
  geom_point(aes(color = Induction), size = 50, alpha = 0.4) +
  labs(x = "PC1 (35.66%)",
       y = "PC2 (26.50%)",
       title = "Principle Component Analysis of the TCP4 microarray") +
  theme_few()

ggplot2 generated PCA visualisation

I would like to use ggbiplot to generate a more informative visualisation like so: https://datacamp.com/community/tutorials/pca-analysis-r.

If I use ggbiplot to do this with the following code:

ggbiplot(pca, scale = 1, obs.scale = 1, 
         varname.abbrev = T, var.axes = F,
         pc.biplot =TRUE, circle = TRUE,
         ellipse = T)

I get the following graph:

base PCA graph

However, if I change the one setting var.axes = T as so:

g <- ggbiplot(pca, scale = 1, obs.scale = 1, 
              varname.abbrev = T, var.axes = T,
              pc.biplot =TRUE, circle = TRUE,
              ellipse = T)

then I get the following blank plot:

blank red graph

Can any help me trouble shoot this?

0

There are 0 best solutions below