使用包vistime
,您可以个性化框的颜色(如果您在数据框中添加“颜色”列或告诉vistime
with col.colors ='yourColourColumnName'
,您可以添加工具提示并分组(col.groups =
).
您可以生成plotly-Timelines、highcharter-Timelines 或ggplot2-Timelines,所有这些都是可个性化的。
install.packages("vistime")
library(vistime)
crono <- read.csv(text="Name,Group,start_year,end_year
First long period,long,1800-01-01,1899-12-31
Second period,short,1870-01-01,1910-12-31
Another long period,long,1900-01-01,1990-12-31
More events on period time,short,1965-01-01,1985-12-31")
events <- read.csv(text="Name,start_year
Person 1 was born,1870-01-01
Person 1 first novel,1895-01-01
Build the new building,1905-01-01
Death person 1,1930-01-01
renovation building,1950-01-01
collection,1970-01-01")
events$end_year <- NA
events$Group <- "Events"
# or gg_vistime, or hc_vistime
vistime(rbind(crono, events),
col.start = "start_year",
col.end = "end_year",
col.event = "Name",
col.group = "Group")
有关个性化的更多信息:https://shosaco.github.io/vistime/ https://shosaco.github.io/vistime/