R语言新包calendR,让你拥有专属日历
calendR为2020年9月14日在CRAN上线的新包。
packageVersion("calendR")
packageDescription("calendR")
packageDate("calendR")
此包只有一个函数calendR(),有众多参数,但理解起来并不难。
calendR(year = format(Sys.Date(), "%Y"), month = NULL, start_date = NULL,
end_date = NULL, start = c("S", "M"), orientation = c("portrait", "landscape"),
title, title.size = 20, title.col = "gray30", subtitle = "", subtitle.size = 10,
subtitle.col = "gray30", text = "", text.pos = NULL, text.size = 4,
text.col = "gray30", special.days = NULL, special.col = "gray90",
gradient = FALSE, low.col = "white", col = "gray30", lwd = 0.5, lty = 1,
font.family = "sans", font.style = "plain", day.size = 3, days.col = "gray30",
weeknames, weeknames.col = "gray30", weeknames.size = 4.5, months.size = 10,
months.col = "gray30", months.pos = 0.5, mbg.col = "white", legend.pos = "none",
legend.title = "", bg.col = "white", bg.img = "", margin = 1, lunar = FALSE,
lunar.col = "gray60", lunar.size = 7, pdf = FALSE, doc_name = "",
papersize = "A4")
shou some code(封面代码)
全年简约版日历
# 默认为当前年
calendR()
定制日历
calendR(year = 2020,month = 10,
title = "2020.10",
title.size=30,
subtitle = "day day up by meng",
special.days = "weekend",
weeknames = c("Mo","Tu","We","Th","Fr","Sa","Su"),
special.col = "Tomato1",
lwd = 0.4,
font.style = "bold",
day.size = 4,
text = c("running",'gym',"上海出差","兼职","约饭\n人生一串(大宁)"),
text.pos=c(1,7,16,18,30),
text.size=3,
text.col="4",
lunar=TRUE,
lunar.col=3)
# 参数解释
# year:表示年份
# month:表示月份
# title:表示标题
# title.size:标题文字大小
# subtitle:副标题
# special.days:突出显示日期,值可为数字或weekend
# weeknames:默认的周一:周天更改为自定义格式
# special.col:突出显示日期的颜色
# lwd:日历中线条的宽度
# font.style:日历中字体样式
# day.size:日历中日期的文本大小
# text:向日历框中添加文本信息
# text.size:文本大小
# text.pos:文本位置
# text.col:文本颜色
# lunar:向日历框中添加月相图
# lunar.col:月相图的颜色
另外参数:还可输出为PDF,设置背景色,添加图例。
剩下的各位发挥吧。