How to modify my R code to plot this kind of gantt chart?

前端 未结 2 1975
轻奢々
轻奢々 2021-01-15 15:46

everybody

with the following code in R, I have display a simple gantt chart :

dat <- read.csv2(text=\"start;duration
 1;4
 7;3
 15;2
 \")
 plot(NA         


        
2条回答
  •  走了就别回头了
    2021-01-15 16:04

    using package vistime:

    install.packages('vistime')
    library(vistime)
    df <- read.table(text="Task, Start, End
    A,2,7
    B,5,10
    C,5,12
    D,16,22
    E,18,20", header=TRUE, sep = ',')
    df$Start <- as.Date("2017-01-01") + df$Start
    df$End <- as.Date("2017-01-01") + df$End
    vistime(df, start="Start", end="End", events="Task")
    

    https://github.com/shosaco/vistime

提交回复
热议问题