Closed jahid10 closed 1 year ago
colvec
should contain one element for each sample, indicating the color in which you want the sample to be plotted.
The order of the samples in that vector should be the same as in met_jute$taxa$genus$abund
.
Also please note that here we provide support for SqueezeMeta, but not to questions related to R or vegan.
Good luck with your analyses!
Hi, I have completed a metagenomic project using the coassembly mode. My run contains 8 samples (4 each from 2 different sources). I want to calculate NMDS on two sources (I have 4 samples from one source named RC and 4 samples from another source SRW, I ran all 8 on coassembly mode). However, since both of my samples are in a single run, I get no distant coloring between . Moreover, I'm also a noob in R. Can you please guide me on how can I rearrange this code to differently color the two sample.
library('vegan') metadata = as.data.frame(c(rep('met_jute', 8))) rownames(metadata) = colnames(met_jute$taxa$genus$abund) colnames(metadata) = 'condition'
Tranpose the matrix to have samples in rows.
genus_mds = t(met_jute$taxa$genus$abund) jute_MDS = metaMDS(genus_mds) colvec = c('#006682','#c26e00' ) # colors plot(jute_MDS, display = 'sites') with(metadata, points(MDS, display = 'sites', col = colvec[condition], pch = 19)) with(metadata, legend('topright', legend = levels(condition), col = colvec, pch = 21, pt.bg = colvec))