tags:

views:

167

answers:

4

Has anybody used R to create a Gantt chart? The only solution that I'm aware of is this, but I'm looking for something more sophisticated, if possible (looking more or less like this or this).

P.S. I could live without the dependency arrows.

P.S.2 Which are the magic words that must be given in the search textbox of R Graphical Manual in order to get the (gantt chart) graph of this page?

+2  A: 

Why the heck try that in R? There are far better tools for that. It is possible, using the plotrix package as you found out already

But that's merely just a plot area, some axes and some boxes drawn on it. You can draw whatever you want in R, including tea kettles, but always ask yourself if you're not trying to change a lightbulb with a chainsaw.

Regarding the R Graphical Manual : gantt chart is not included yet. Feel free to add to the community ;-)

Joris Meys
Could you provide some links to the better tools?
Marek
Karsten W.
You can start with Excel to make gantt charts. Microsoft Visio offers a whole bunch of different project charts and flow diagrams. Microsoft Project is designed to manage projects, as are a number of other specific software packages. And as Karsten indicated, on Sourceforge there's a whole list of free software tools to create complete gantt charts.
Joris Meys
+1  A: 

Here's a post that I wrote on using ggplot to generate something like a Gantt chart. Not very sophisticated, but might give you some ideas.

neilfws
+2  A: 

A simple ggplot2 gantt chart.

First, we create some data.

tasks <- c("Review literature", "Mung data", "Stats analysis", "Write Report")
dfr <- data.frame(
  name        = factor(tasks, levels = tasks),
  start.date  = c("24/08/2010", "01/10/2010", "01/11/2010", "14/02/2011"),
  end.date    = c("31/10/2010", "14/12/2010", "28/02/2011", "30/04/2011"),
  is.critical = c(TRUE, FALSE, FALSE, TRUE)
)
mdfr <- melt(dfr, measure.vars = c("start.date", "end.date"))

Now draw the plot.

ggplot(mdfr, aes(as.Date(value, "%d/%m/%Y"), name, colour = is.critical)) + 
  geom_line(size = 6) +
  xlab("") + ylab("") +
  theme_bw()
Richie Cotton
I could only create some data twice :-)
gd047
@gd047: That calls for a two-handed facepalm. Idiocy now fixed.
Richie Cotton
It's very nice, but what I'm mostly looking for is a way to show more than one bar for each task (as you can see in the examples I gave) e.g. one for the baseline and one for the actual task duration. Is there a way to do something like this?
gd047
+1  A: 

Try this:

install.packages("plotrix")
library(plotrix)
?gantt.chart
juur