plot,gantt-method | R Documentation |
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.
## 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,
...
)
x |
A gantt object. |
xlim |
optional range of time axis; if not provided, the range of times
in |
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.lines.by |
suggested interval between vertical grid lines on the
plot, e.g. |
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 |
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 |
main |
character string to be used as chart title. |
line.main |
line where title occurs. If |
cex.main |
numeric, font-size factor for title. |
mgp |
setting for par |
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, |
debug |
logical value, |
... |
extra things handed down. |
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.
Dan Kelley
Gantt diagrams are described on wikipedia
https://en.wikipedia.org/wiki/Gantt_Chart
.
Other things related to gantt data:
as.gantt()
,
gantt-class
,
ganttAddTask()
,
gantt
,
read.gantt()
,
summary,gantt-method
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.