How do I put labels for this barplot? I have put the legend in but it is appearing inside the text. I need to add four labels on the x-axis, blue -Dorper, Dorpersm, green - Namafr and red -SAMM
colors=c("red","blue","green").
meanQ<-read.table("fastk3.txt", header=T)
#concatenate only last 4 rows of data together
annie<-meanQ[c("SAMM","DORPER", "Namafr")]
jpeg(file="Rplotk3.jpg", bg="white", width=720, height=240, units="px", pointsize=14)
#margins (bottom, left, top, right)
par(mai=c(0.25,1,0.25,0.5))
# Get population information
barplot(t(as.matrix(annie)), width = 1, space = 0, beside = FALSE, col=colors, legend.text = TRUE, args.legend = list (x = "topright")
,xlab = "Genotypes", ylab = "Ancestry" , border = NA, xaxt = "n", offset = 0, axes = TRUE, axisname = TRUE)
dev.off()