ggplot2 绘图 —— 甘特图

甘特图

需要vistime包

>library(vistime)
>pres <- data.frame(
  Position = rep(c("President", "Vice"), each = 3),
  Name = c("Washington", rep(c("Adams", "Jefferson"), 2), "Burr"),
  start = c("1789-03-29", "1797-02-03", "1801-02-03"),
  end = c("1797-02-03", "1801-02-03", "1809-02-03"),
  color = c("#cbb69d", "#603913", "#c69c6e")
)
>pres
   Position       Name      start        end   color
1 President Washington 1789-03-29 1797-02-03 #cbb69d
2 President      Adams 1797-02-03 1801-02-03 #603913
3 President  Jefferson 1801-02-03 1809-02-03 #c69c6e
4      Vice      Adams 1789-03-29 1797-02-03 #cbb69d
5      Vice  Jefferson 1797-02-03 1801-02-03 #603913
6      Vice       Burr 1801-02-03 1809-02-03 #c69c6e
gg_vistime(pres, events = "Position", 
			groups = "Name", title = "Presidents of the USA")

ggplot2 绘图 —— 甘特图_第1张图片

你可能感兴趣的:(#,ggplot2,R)