[R] Time Series-like barplot?

Andy Bunn abunn at montana.edu
Wed Mar 19 19:15:14 CET 2003


I have data structured like the following:

> foo.mat <- matrix(NA, ncol = 5, nrow = 10)
> foo.mat[2:6,1] <- 1
> foo.mat[1:3,2] <- 1
> foo.mat[3:10,3] <- 1
> foo.mat[1:10,4] <- 1
> foo.mat[8:10,5] <- 1
> foo.mat
      [,1] [,2] [,3] [,4] [,5]
 [1,]   NA    1   NA    1   NA
 [2,]    1    1   NA    1   NA
 [3,]    1    1    1    1   NA
 [4,]    1   NA    1    1   NA
 [5,]    1   NA    1    1   NA
 [6,]    1   NA    1    1   NA
 [7,]   NA   NA    1    1   NA
 [8,]   NA   NA    1    1    1
 [9,]   NA   NA    1    1    1
[10,]   NA   NA    1    1    1

I am trying to create a plot with horizontal bars that has 1:10 on the
x-axis and plots the length of the data (i.e., 1) in the correct context.
E.g.,:

  5               ------
  4 --------------------
  3     ----------------
  2 -----
  1   ---------
   1-2-3-4-5-6-7-8-9-10


Does any body have a suggestion?

Thanks, Andy



More information about the R-help mailing list