legend - R stacked barchart label mismatch -


i have molecular sequencing data of relative abundance (in %) of various phyla in 9 different samples , trying plot colour-coded barchart (where each phyla corresponds different colour). simple enough on excel, complete newbie on r, struggling quite bit. data in excel format (formated tabs), first line labels (e.g.sample name)- when plotting it, bar labels misplaced, not match, , r plots first line of excel file (the names) separate value (pictures attached). have far is:

attach(data)  data.1<-as.matrix(data) par(mfrow=c(1,1)) barplot(data.1, col=c("aquamarine3","azure2","blue2","brown3","cadetblue3","deepskyblue3","firebrick3","gold3","darkorange3","darkorchid3","darkseagreen","darkslateblue","darkviolet","deeppink4"), main=".", xlab="unit/treatment", ylab="% relative abundance") detach(data)  legend("topright", inset=c(-0.2,0),        legend = c("unassigned", "acidobacteria","actinobacteria","bacteroidetes","chlorobi","chloroflexi","firmicutes","gemmatimonadetes","planctomycetes","proteobacteria","verrucromicrobia","euryarchaeota","crenarchaeota","parvarchaeota"),         fill = c("aquamarine3","azure2","blue2","brown3","cadetblue3","deepskyblue3","firebrick3","gold3","darkorange3","darkorchid3","darkseagreen","darkslateblue","darkviolet","deeppink4")) par(mar=c(5.1, 4.1, 4.1, 8.1), xpd=true) layout(mat, widths = rep.int(1, ncol(mat)),        heights = rep.int(1, nrow(mat)), respect = false) 

as result, this:

barchart attempt, r plots sample names x_1 , moves other labels. also, legend covers majority of barchart , cannot seem adjust it.

thanks in advance- getting barchart decently-looking highly appreciated.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -