timelineS: Timeline with Event Labels

Description Usage Arguments Details Author(s) See Also Examples

View source: R/timelineS.R

Description

Plots a horizontal timeline with event descriptions at corresponding dates.

Usage

1
2
3
4
5
6
7
8
timelineS(df, main = NA, xlab = NA, buffer.days = 600,
         line.width = 5, line.color = "gray44",
         scale = "year", scale.format = "%Y", scale.font = 2, scale.orient = 1,
         scale.above = FALSE, scale.cex = 1, scale.tickwidth = 2,
         labels = paste(df[[1]], df[[2]]), label.direction = "downup",
         label.length = c(0.5,0.5,0.8,0.8), label.position = c(1,3),
         label.color = "gray44", label.cex = 0.8, label.font = 1, label.angle = 0,
         pch = 20, point.cex = 1, point.color = "gray44")

Arguments

df

Data frame for events and dates. First column for event names and second column for dates in Date class.

main

Title of the plot.

xlab

X axis label.

buffer.days

Additional days to add before and after the event dates on the timeline. Default is 600 days.

line.width

Timeline width; default 5

line.color

Timeline color.

scale

Scale on timeline. One of "year","quarter", "month", "week" or "day". See seq.Date.

scale.format

Scale format; default "%Y".

scale.font

Integer specifying font of scale. Default is 2. (1:plain, 2:bold, 3:italic, 4:bold italic, 5:symbol).

scale.orient

Orientation of scale; default 1(upright)

scale.above

If TRUE, the scale shows above the line.

scale.cex

Scale font size relative to cex.

scale.tickwidth

Width of scale tick; default 2.

labels

Event labels. Events and corresponding dates as default.

label.direction

Direction of labels from timeline. "downup","updown","up", or "down", default is "downup". See details.

label.length

Distance of event label from the timeline. Could be a single value or a vector of lengths. Default is c(0.5, 0.5, 0.8, 0.8). See details.

label.position

Integer specifying label positions; default c(1,3). See details.

label.color

Label color(s).

label.cex

Font size(s) of event labels; default 0.8.

label.font

Integer specifying label font; default 1.

label.angle

Angle of text in the label.

pch

End point symbol(s).

point.cex

End points size(s).

point.color

End points color(s).

Details

label.direction indicates the direction of event labels from timeline. "downup" and "updown" plots alternating labels; "up" puts all the labels above and "down" below the timeline.

label.length could be a single number or a numeric vector. For label directions "downup" and "updown", use between 0 and 0.9, and for "up" and "down", use between 0 and 1.6. For example, label.length = 0.5 produces all the labels at equal lengths, and label.length = c(0.5,0.5,0.8,0.8) repeats the sequence of lengths.

The positions for label.position are 1: below 2: left 3: above 4: right.

Author(s)

Dahee Lee

See Also

axis.Date, timelineG, durCalc, durPlot

Examples

1
2
3
4
5
6
7
### Default down-up labels
timelineS(mj_life, main = "Life of Michael Jackson")

### Labels above timeline and other change in aesthetics
timelineS(mj_life, main = "Life of Michael Jackson",
label.direction = "up", label.length = c(0.2,0.8,0.4,1.2), label.position = 3,
line.color = "blue", label.color = "blue", point.color = "blue", pch = "-")

timelineS documentation built on May 2, 2019, 8:57 a.m.