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

  • idfor ID of each interval

  • idnfor order of ID

  • startfor starting time

  • endfor ending time with arrow head

  • labelfor 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 Oct. 21, 2022, 1:05 a.m.