Hi, I want to make barplots from different questions (columns) in one data.frame. Each question has the same 5 likert items. Now the problem: in some questions all items are answered; in other less. >From the syntax below I get nice stack barplots - *but the legend colors do not* refer to the same likert-item, which I understand - the colors go in sequence along the table. Question: how can I write a syntax that each likert-item has the same legend color? Thank you in advance,
Roberto SYNTAX: counts19 <- table(teamq[,19]) counts20 <- table(teamq[,20]) barplot(as.matrix(counts19), horiz = T, col=c("yellow","sandybrown","orange", "darkolivegreen","green"), legend=T) barplot(as.matrix(counts20), horiz = T, col=c("yellow","sandybrown","orange", "darkolivegreen","green"), legend=T) [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.