barplot() defaults to stacked bars for matrices and uses the colors
fresh for each bar: e.g.,
layout(1:2)
barplot(matrix(1:6, 2), col = c("red", "blue","green"))
barplot(matrix(1:6, 3), col = c("red", "blue","green"))
To get what you are looking for, try something like this:
x = matrix(1:6,1); c
On 5 Dec 2011, at 15:58, R. Michael Weylandt wrote:
> x <- c(2L, 108L, 0L, 0L, 0L, 1L, 3L, 0L, 0L, 0L, 0L, 0L, 7L, 18L,
> 3L, 4L, 8L, 20L, 26L, 20L, 19L, 7L, 1L, 1L)
> mycol = c(rep('yellow', 2), rep('white', 3), rep('orange',2),
> rep('white', 5), rep('orange',3), rep('red',9))
> barplot(x, col
x <- c(2L, 108L, 0L, 0L, 0L, 1L, 3L, 0L, 0L, 0L, 0L, 0L, 7L, 18L,
3L, 4L, 8L, 20L, 26L, 20L, 19L, 7L, 1L, 1L)
mycol = c(rep('yellow', 2), rep('white', 3), rep('orange',2),
rep('white', 5), rep('orange',3), rep('red',9))
barplot(x, col = mycol)
Produces a multi-colored barplot on my machine so I un
On Dec 5, 2011, at 10:44 AM, Federico Calboli wrote:
Hi All,
I'm having a problem with barplot:
mydata
[1,] 2 108 0 0 0 1 3 0 0 0 0 0 7 18 3 4 8 20 26 20
19 7 1 1
mycol = c(rep('yellow', 2), rep('white', 3), rep('orange',2),
rep('white', 5), rep('orange',3), rep('red',
Hi All,
I'm having a problem with barplot:
mydata
[1,] 2 108 0 0 0 1 3 0 0 0 0 0 7 18 3 4 8 20 26 20 19 7 1 1
mycol = c(rep('yellow', 2), rep('white', 3), rep('orange',2), rep('white', 5),
rep('orange',3), rep('red',9))
barplot(mydata, col = mycol)
gives me an uniformly yell
5 matches
Mail list logo