[R] Simple Gantt like chart for numbers rather dates

Graham Smith myotisone at gmail.com
Sun Oct 19 15:22:12 CEST 2008


Gabor,

> Then try something like this.  We plot it as a stacked
> horizontal bargraph where the first bar in the stack is white
> and with border = 0 so its not visible.
>
> # test data - rows are from and to points and
> # column names are the labels
> mat <- matrix(1:10, 2, byrow = TRUE,
>        dimnames = list(c("from", "to"), letters[1:5]))
>
> bp <- barplot(mat, col = c("white", "lightblue"), border = 0, horiz = TRUE)
> text(mat[1, ], bp, mat[1,], pos = 4)
> text(colSums(mat), bp, mat[2,], pos = 2)

Thanks, that's a clever approach, I think I will still have a go at
editing the Gantt code, but I can get my head around this approach a
bit easier.

Graham



More information about the R-help mailing list