I want to build a black and white bar graph, that shows groups of column in line order. Eg. using the matrix below, I want to have 4 sets of columns in the order (XX,YY):
first set: (A,A)(A,B)(A,C)(A,D)
second set: (B,A)(B,B)(B,C)(B,D)
third set: (C,A)(C,B)(C,C)(C,D)
fourth set: (D,A)(D,B)(D,C)(D,D)
[1] Values:
A B C D
A 0 40 91 19
B 84 0 99 26
C 57 901 0 20
D 37 186 196 0
I use this R script [3], but the problem is that it is building the graph in column order. Eg,
first set: (A,A)(B,A)(C,A)(D,A)
Second set: (A,B)(B,B)(C,B)(D,B)
Third set: (A,C)(B,C)(C,C)(D,C)
fourth set: (A,D)(B,D)(C,D)(D,D)
How can I build this graph in column order and in black&white and using patterns?
[3] R script
# Read values from tab-delimited autos.dat
autos_data <- read.table("autos_data.dat", header=T, sep="\t")
# Graph autos with adjacent bars using rainbow colors
barplot(as.matrix(autos_data), main=NULL, ylab= "Size", beside=TRUE, col=rainbow(5))
# Place the legend at the top-left corner with no frame using rainbow colors
legend("topleft", c("A","B","C","D"), cex=0.6, bty="n", fill=rainbow(5));