前言
一眨眼2020即将过去,2020年是杂乱的一年,感谢我们还活着。让我们放下这年,展望2021年吧。要不用R给2021年做个私人定制版日历吧?
翻了翻张杰老师的可视化书,咦,确实有这么一小节讲述用ggplot2做的日历图。在此就不做过多的描述,文章链接为:R-ggTimeSeries | ggplot2: 热力日历图。但是对于R小白的我而言,私人定制2021年日历,不简单啊。
找了下必应,找到了calendR这个包,强烈给R小白们安利,简单几行代码就可以实现私人化日历定制了,还可以打印出来,挂在书桌旁。
今天先给大家送上几个我做好的2021年日历和月历demo。创建私人定制日历图的详细教程预计会在两天后推出,敬请期待。
2021年日历图
版本一
版本二
img <- "C:/Users/ZLL/Desktop/4.jpg" calendR(year = 2021, start = "M", title.col = "white", # Weeks start on Monday mbg.col = 3, # Background color of the month names months.col = "white", # Color of the text of the month names weeknames.col = "white", special.days = "weekend", # Color the weekends special.col = "lightblue", # Color of the special.days lty = 0, # Line type (no line) weeknames = c("Mo", "Tu", # Week names "We", "Th", "Fr", "Sa", "Su"), title.size = 40, # Title size orientation = "p", bg.img = img, pdf = TRUE, doc_name = "My_calendar1" )
2021年月历图
版本一
版本二
img <- "C:/Users/ZLL/Desktop/4.jpg" invisible(sapply(1:12 , function(i) calendR(year = 2021,month = i, pdf = TRUE, title.col = "white", mbg.col = 3, months.col = "white", weeknames.col = "white", special.days = "weekend", special.col = "lightblue", lty = 0, bg.img = img, doc_name = file.path("C:\\Users\\ZLL\\Documents\\calendar", paste0("Calendar(blue)_2021_", i)))) )



