[R] Simple Gantt like chart for numbers rather dates

Gabor Grothendieck ggrothendieck at gmail.com
Sun Oct 19 15:12:00 CEST 2008


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)


On Sun, Oct 19, 2008 at 6:49 AM, Graham Smith <myotisone at gmail.com> wrote:
> Jim,
>
>> Gabor is right, gantt.chart comes close but you will have to change all the
>> POSIXct axis calls to plain old axis calls and manually create the list of
>> gantt.info with the x values as numbers.
>
> Mmm, I have had a quick look at the code and it seems a bit beyond me,
> but it could be a good exercise :-)
>
> Certainly, this exactly what I want.
>
> Thanks,
>
> Graham
>
> ______________________________________________
> R-help at r-project.org 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.
>



More information about the R-help mailing list