Hi R Users! Thanks in advance. I am using R-2.5.1 on Windows XP. I am trying to do a stacked bar plot, but could not get through the following problem. The code is given below. 1. How can I provide 15 different colors for each method with 15 Rows? 2. How can I put the legend in a particular position (eg., in the top or bottom or right or left)? How can I put legend using a number of rows (eg., using two or three rows)? Once again thank you very much for your time. Regards, Debabrata (Deb) Statistician NSW Department of CommerceSydney, Australia.
The Code: library(lattice) library(graphics) x <- matrix(1:75, ncol= 5) dimnames(x)[[2]] <- paste("Method", 1:5, sep="") dimnames(x)[[1]] <- paste("Row", 1:15, sep="") # library: graphics barplot(x, beside=FALSE, col= 1:nrow(x), legend= rownames(x) ) # library: lattice barchart(Freq ~ Var2, data = as.data.frame.table(x), groups = Var1, stack = TRUE, auto.key = TRUE) --------------------------------- Park yourself in front of a world of choices in alternative vehicles. [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch mailing list 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.