[R] Gantt chart - more than one colour on a line

D Holl deedee703 at gmail.com
Tue May 11 17:52:12 CEST 2010


Dear all

I would like to plot a Gantt chart type plot, but with more than one
colour on a line. The gantt.chart function will allow me to add more
than one bar on a line, but it is in the same colour as the first bar
on that line. For example (using the code helpful provided in the R
graphics gallery)

require(plotrix)

Ymd.format <- "%Y/%m/%d"

Ymd <- function(x){ as.POSIXct(strptime(x, format=Ymd.format))}
gantt.info <- list(
  labels     =c("First task","Second task","Third task","Fourth
task","Fifth task","First task"),
  starts     =Ymd(c("2004/01/01","2004/02/02","2004/03/03","2004/05/05","2004/09/09",
"2004/09/01")),
  ends       =Ymd(c("2004/03/03","2004/05/05","2004/05/05","2004/08/08","2004/12/12",
"2004/09/10")),
  priorities =c(1,2,3,4,5,5))

gantt.chart(gantt.info,main="Calendar date Gantt chart")

Both bars in the first line are red=priority level 1, rather than one
red (level 1) and one purple (level 5)

Am I missing some simple option in the gantt.chart function, or do I
have to program the chart another way?

Many thanks for any assistance,

Kind regards

DD



More information about the R-help mailing list