time_plot_event: Plot labeled events

View source: R/helper_timerelated2.R

time_plot_eventR Documentation

Plot labeled events

Description

Create a plot for events with labels

Usage

time_plot_event(dt, xlab = "Time", anchor = TRUE, compact = FALSE)

Arguments

dt

a data.frame with the following columns

id

for ID of each group

idn

for order of ID

start

for starting time

end

for ending time with arrow head

label

for labeling the starting time

labelend

for labeling the ending time of a interval

type

for event type as one of p (point), i (interval), b (box)

color

a string for event color

xlab

A string for the x-axis title

anchor

A Boolean value for the vertical lines linking start to the x-axis

compact

A Boolean value for reducing the vertical spacing when applicable

Value

a plot

Examples

library(ggplot2)
dt = data.frame( id=paste('member',c(rep(c(1,2,3),each=3),3),sep=""),
idn=c(rep(1,3),rep(-1,3), rep(2,4)),
start=1800*c(0,1,2, 0.5, 1.2, 3, 1,2,3,4),
end=1800*c(2,NA,3, 2, 6, NA, 2,2.5,3, 3.5),
label=c(paste('event-',seq(1,10),sep='')),
labelend=c('','','?',')','','','','','>','X'),
type=c('b', 'p', 'i','i','p','p','p','b','i','i' ),
color=c('stove', 'oven', 'oven','oven','stove','oven','oven','other','stove','oven' )
 )
time_plot_event( dt )


mtb documentation built on April 12, 2025, 2:23 a.m.