plot-gantt-method: Draw a Gantt diagram

Description Usage Arguments Details Author(s) References See Also Examples

Description

Plot a gantt chart that shows the time allocated to a set of tasks, optionally also with an indication of discrete events that occur as instants in time.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S4 method for signature 'gantt'
plot(x, xlim, time.format = NULL, time.labels.by,
  time.lines.by, event.time = NULL, event.label = NULL, event.side = 3,
  col.connector = "black", col.done = gray(0.3), col.notdone = gray(0.9),
  col.eventLine = gray(0.1), col.event = par("fg"),
  cex.event = par("cex"), font.event = par("font"),
  lty.eventLine = par("lty"), lwd.eventLine = par("lwd"), bg = par("bg"),
  grid.col = "lightgray", grid.lty = "dotted", ylabels = list(col = 1, cex
  = 1, font = 1, justification = 1), arrows = NULL, main = "",
  line.main = NA, cex.main = par("cex"), mgp = c(2, 0.7, 0),
  maiAdd = rep(0, 4), axes = TRUE, debug = FALSE, ...)

Arguments

x

A gantt object, i.e. one inheriting from gantt-class.

xlim

optional range of time axis; if not provided, the range of times in x will be used.

time.format

format for dates on time axis; defaults to 3-letter month.

time.labels.by

suggested label increment on time axis, e.g. time.labels.by="2 months" to get a two-month interval. If not supplied, the axis will be generated automatically.

time.lines.by

suggested interval between vertical grid lines on the plot, e.g. time.lines.by="1 week" for weekly. If not supplied, the grid will be generated automatically.

event.time

vector of event times, e.g. conferences, whose time cannot be altered.

event.label

vector of character strings holding event names.

event.side

side for event labels.

col.connector

colour of (optional) connectors between items.

col.done

colour of work that has been done already. This may be a vector of colours, one for each item in the gantt table.

col.notdone

colour of work that has not been done yet. This may be a vector of colours, one for each item in the gantt table.

col.eventLine

colour of event lines; may be a vector.

col.event

colour of event labels; may be a vector.

cex.event

expansion factor for event labels; may be a vector.

font.event

font for event labels; may be a vector.

lty.eventLine

line type for event lines; may be a vector.

lwd.eventLine

line width for event lines; may be a vector.

bg

background colour for plot.

grid.col

colour for grid.

grid.lty

line type for grid.

ylabels

A list with elements col for colour, cex for character-expansion factor, font for font, and justification for the placement in the margin (0 means left-justified, and 1 means right-justified. (NOTE: left-justification works poorly in RStudio, but properly in other systems.) It usually makes sense for the elements in ylabels to be vectors of the same length as the topic list. However, shorter vectors are permitted, and they lengthened by copying the default values at the end (see Example 6).

arrows

A vector of strings, one for each topic, indicating the nature of the arrows that may be drawn at the ends of task bars. The individual values may be "left", "right", "both" or "neither". Set arrows=NULL, the default, to avoid such arrows.

main

character string to be used as chart title.

line.main

line where title occurs. If NA, then the title is placed in a default location; otherwise, it is line.main lines above the top of the plot.

cex.main

numeric, font-size factor for title.

mgp

setting for par(mgp), within-axis spacing. The default value tightens axis spacing.

maiAdd

inches to add to the auto-computed margins at the bottom, left, top, and right margins. The values may be negative (to tighten margins) but the sum will be truncated to remain positive.

axes

logical, TRUE to draw the x axis. (Setting to FALSE permits detailed axis tweaking.)

debug

logical value, TRUE to monitor the work.

...

extra things handed down.

Details

Time is indicated along the x axis, and tasks are stacked along the y axis, akin to progress bars. Colour-coding can be used to indicate the degree of completion of each task. These codes can be set individually for individual tasks. Progress bars can have arrows (on either end), suggesting tasks with flexible start/end dates or overdue tasks. Vertical lines may be drawn for discreet events. See “Examples” for a few of the possibilities.

Author(s)

Dan Kelley

References

Gantt diagrams are described on wikipedia http://en.wikipedia.org/wiki/Gantt_Chart.

See Also

Other things related to gantt data: as.gantt, gantt-class, ganttAddTask, gantt, read.gantt, summary,gantt-method

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library(plan)
data(gantt)
summary(gantt)

# 1. Simple plot
plot(gantt)

# 2. Plot with two events
event.label <- c("Proposal", "AGU")
event.time <- c("2008-01-28", "2008-12-10")
plot(gantt, event.label=event.label,event.time=event.time)

# 3. Control x axis (months, say)
plot(gantt,labels=paste("M",1:6,sep=""))

# 4. Control task colours
plot(gantt,
     col.done=c("black", "red", rep("black", 10)),
     col.notdone=c("lightgray", "pink", rep("lightgray", 10)))

# 5. Control event colours (garish, to illustrate)
plot(gantt, event.time=event.time, event.label=event.label,
     lwd.eventLine=1:2, lty.eventLine=1:2,
     col.eventLine=c("pink", "lightblue"),
     col.event=c("red", "blue"), font.event=1:2, cex.event=1:2)

# 6. Top task is in bold font and red colour
plot(gantt,ylabels=list(col="red",font=2))

# 7. Demonstrate zero-time item (which becomes a heading)
gantt[["description"]][1] <- "Preliminaries"
gantt[["end"]][1] <- gantt[["start"]][1]
plot(gantt, ylabel=list(font=2, justification=0))

# 8. Arrows at task ends
plot(gantt, arrows=c("right","left","left","right"))

Example output

Key, Description,            Start,      End,        Done, NeededBy
  1, Assemble equipment,     2008-01-01 04:00:00, 2008-03-28 03:00:00,   90
  2, Test methods,           2008-02-28 04:00:00, 2008-03-28 03:00:00,   30
  3, Field sampling,         2008-04-01 03:00:00, 2008-08-14 03:00:00,    0
  4, Analyse field data,     2008-06-30 03:00:00, 2008-11-14 04:00:00,    0
  5, Write methods chapter,  2008-08-14 03:00:00, 2008-11-14 04:00:00,    0
  6, Write results chapter,  2008-10-14 03:00:00, 2009-01-15 04:00:00,    0
  7, Write other chapters,   2008-12-10 04:00:00, 2009-02-28 04:00:00,    0
  8, Committee reads thesis, 2009-02-28 04:00:00, 2009-03-14 03:00:00,    0
  9, Revise thesis,          2009-03-15 03:00:00, 2009-03-30 03:00:00,    0
 10, Thesis on display,      2009-04-01 03:00:00, 2009-04-15 03:00:00,    0
 11, Defend thesis,          2009-04-16 03:00:00, 2009-04-17 03:00:00,    0
 12, Finalize thesis,        2009-04-18 03:00:00, 2009-05-07 03:00:00,    0
Warning message:
In rug(subTics) : some values will be clipped
Warning message:
In rug(subTics) : some values will be clipped
Warning message:
In rug(subTics) : some values will be clipped
Warning message:
In rug(subTics) : some values will be clipped
Warning messages:
1: In axis(side, at = z, labels = labels, ...) :
  "lwd.eventLine" is not a graphical parameter
2: In axis(side, at = z, labels = labels, ...) :
  "lty.eventLine" is not a graphical parameter
3: In axis(side, at = z, labels = labels, ...) :
  "col.eventLine" is not a graphical parameter
4: In axis(side, at = z, labels = labels, ...) :
  "font.event" is not a graphical parameter
5: In axis(side, at = z, labels = labels, ...) :
  "cex.event" is not a graphical parameter
6: In rug(subTics) : some values will be clipped
Warning messages:
1: In axis(side, at = z, labels = labels, ...) :
  "ylabels" is not a graphical parameter
2: In rug(subTics) : some values will be clipped
Warning messages:
1: In axis(side, at = z, labels = labels, ...) :
  "ylabel" is not a graphical parameter
2: In rug(subTics) : some values will be clipped
Warning messages:
1: In axis(side, at = z, labels = labels, ...) :
  "arrows" is not a graphical parameter
2: In rug(subTics) : some values will be clipped

plan documentation built on May 1, 2019, 9:17 p.m.