time_plot_interval: Plot periods of events

View source: R/helper_timerelated.R

time_plot_intervalR Documentation

Plot periods of events

Description

Create a plot for event periods by ID

Usage

time_plot_interval(
  dt,
  xlab = "DateTime",
  ylab = "ID",
  legend_title = "Group",
  arrow_wt = 1,
  arrow_color = "black"
)

Arguments

dt

a data.frame with the following columns

id

for ID of each interval

idn

for order of ID

start

for starting time

end

for ending time with arrow head

label

for labeling the starting time

xlab

A string for the label of X-axis

ylab

A string for the label of Y-axis

legend_title

A string for the title of legend

arrow_wt

An integer for the weight of arrow

arrow_color

A string for the color of arrow

Value

a plot

Examples

library(ggplot2)
dt = data.frame( id=c('ID01','ID12','ID3'), idn=c(1,3,2), start=1800*c(0,1,2), end=1800*c(2,-1,3),
label=c('A','B','C') )
time_plot_interval( dt, xlab='Time', ylab='ID', legend_title='Group', arrow_wt=3,
arrow_color='gray')


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