plotting PCOA output with ggbiplot

692 views
Skip to first unread message

Cara Joos

unread,
Sep 16, 2015, 7:53:26 PM9/16/15
to ggplot2





I am trying to create an output from ggbiplot for the results. I have not been able to modify the output from the simple biplot function in the code at the bottom. The modifications possible with the base code do not change the graphic. I want to create elipses around significant groupings and arrows going from them instead of from every species. I would also like to split this into 4 panels like is possible within ggplot2 as it is difficult to read this figure with so many species. The only way I could get all of the data to fit in the box was to make it very very large, which worked for a poster but was still much less than ideal.


data <-read.csv("shrub_final_pcoa.csv",sep = ",",row.names = 1)
data <-as.data.frame(data)
data_log <-log(data+1)
data_D <-vegdist(data_log, "bray")
dist <- pcoa(data_D)
dist$values
data_st = apply(data, 2, scale, center = T, scale = T)
quartz(8,11)
biplot(dist, data_st)




This example code produces exactly the figure I want:

data(wine)
wine.pca <- prcomp(wine, scale. = TRUE)
print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class, ellipse = TRUE, circle = TRUE))

but it is not easily modifiable to PCOA output because it uses 2 seperate dataframes in the biplot and they aren't combinable into a dataset similar to the output of a PCA, or at least I don't yet know how to combine them into a similar dataset.

Hopefully someone can help me out!
Thanks
Cara

shrub_final_pcoa.csv
Reply all
Reply to author
Forward
0 new messages