gantt_wrap | R Documentation |
A ggplot2 wrapper that produces a Gantt plot.
gantt_wrap(
dataframe,
plot.var,
facet.vars = NULL,
fill.var = NULL,
title = NULL,
ylab = plot.var,
xlab = "duration.default",
rev.factor = TRUE,
transform = FALSE,
ncol = NULL,
minor.line.freq = NULL,
major.line.freq = NULL,
sig.dig.line.freq = 1,
hms.scale = NULL,
scale = NULL,
space = NULL,
size = 3,
rm.horiz.lines = FALSE,
x.ticks = TRUE,
y.ticks = TRUE,
legend.position = NULL,
bar.color = NULL,
border.color = NULL,
border.size = 2,
border.width = 0.1,
constrain = TRUE,
plot = TRUE
)
dataframe |
A data frame with plotting variable(s) and a column of start and end times. |
plot.var |
A factor plotting variable (y axis). |
facet.vars |
An optional single vector or list of 1 or 2 to facet by. |
fill.var |
An optional variable to fill the code strips by. |
title |
An optional title for the plot. |
ylab |
An optional y label. |
xlab |
An optional x label. |
rev.factor |
logical. If |
transform |
logical. If |
ncol |
if an integer value is passed to this
|
minor.line.freq |
A numeric value for frequency of minor grid lines. |
major.line.freq |
A numeric value for frequency of major grid lines. |
sig.dig.line.freq |
An internal rounding factor for minor and major line freq. Generally, default value of 1 suffices for larger range of x scale may need to be set to -2. |
hms.scale |
logical. If |
scale |
Should scales be fixed ( |
space |
If |
size |
The width of the plot bars. |
rm.horiz.lines |
logical. If |
x.ticks |
logical. If |
y.ticks |
logical. If |
legend.position |
The position of legends. ( |
bar.color |
Optional color to constrain all bars. |
border.color |
The color to plot border around Gantt bars (default is
|
border.size |
An integer value for the size to plot borders around Gantt bars. Controls length (width also controlled if not specified). |
border.width |
Controls border width around Gantt bars. Use a numeric value in addition to border size if plot borders appear disproportional. |
constrain |
logical. If |
plot |
logical. If |
Returns a Gantt style visualization. Invisibly returns the ggplot2 list object.
For non-repeated measures data/plotting use gantt
;
for repeated measures data output use gantt_rep
; and for
a convenient wrapper that takes text and generates plots use
gantt_plot
.
Andrie de Vries and Tyler Rinker <tyler.rinker@gmail.com>.
Clark, W. & Gantt, H. (1922) The Gantt chart, a working tool of management. New York, Ronald Press.
gantt
,
gantt_plot
,
gantt_rep
,
facet_grid
,
facet_wrap
## Not run:
dat <- gantt(mraja1$dialogue, list(mraja1$fam.aff, mraja1$sex),
units = "sentences", col.sep = "_")
htruncdf(dat)
gantt_wrap(dat, "fam.aff_sex", title = "Gantt Plot")
dat$codes <- sample(LETTERS[1:3], nrow(dat), TRUE)
gantt_wrap(dat, "fam.aff_sex", fill.var = "codes",
legend.position = "bottom")
dat2 <- with(rajSPLIT, gantt_rep(act, dialogue,
list(fam.aff, sex), units = "words", col.sep = "_"))
htruncdf(dat2)
x <- gantt_wrap(dat2, "fam.aff_sex", facet.vars = "act",
title = "Repeated Measures Gantt Plot")
library(ggplot2); library(scales); library(RColorBrewer)
x + scale_color_manual(values=rep("black",
length(levels(dat2$fam.aff_sex))))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.