python打印日历_ 简单,可打印,自定义日历和周计划

ggweekly

The goal of ggweekly is to easily create custom weekly planners with ggplot2.

Installation

You can install ggweekly from GitHub with devtools

devtools::install_github("gadenbuie/ggweekly")

Example

This is a basic example which shows you how to create a weekly planner covering April, May, and June of 2019.

library(ggweekly)

ggweek_planner(

start_day = "2019-04-01",

end_day = "2019-06-30",

)

README-year-week-1.png

You can also create traditional calendars as well.

ggweek_planner(

start_day = "2019-04-01",

end_day = "2019-06-30",

show_month_boundaries = FALSE,

show_month_start_day = FALSE,

week_start = "isoweek",

week_start_label = "week"

) +

ggplot2::ggtitle("2019") +

ggplot2::facet_wrap(~ month, scales = 'free')

README-yearly-calendar-1.png

Use week_start to choose between weeks that start on Monday ("isoweek") or weeks that start on Sunday ("epiweek"). You can also set (or remove) the weekend color fill with weekend_fill.

ggweek_planner(

start_day = "2019-04-01",

end_day = "2019-06-30",

show_month_boundaries = FALSE,

show_month_start_day = FALSE,

week_start = "epiweek",

week_start_label = "week",

weekend_fill = "#FFFFFF"

) +

ggplot2::ggtitle("2019") +

ggplot2::facet_wrap(~ month, scales = 'free')

README-yearly-calendar-opts-1.png

Project Planning

Create a tibble of days to highlight and pass into highlight_days.

project_days <- dplyr::tribble(

~day, ~label, ~color, ~fill,

"2019-07-02", "Project Kick Off", "#02307a", "#02307a",

"2019-07-12", "LOI Due", "#02307a", "#02307a",

"2019-07-26", "First Draft", "#02307a", "#02307a",

"2019-08-05", "Work week", "#bf006c", "#bf006c",

"2019-08-06", NA, NA, "#bf006c",

"2019-08-07", NA, NA, "#bf006c",

"2019-08-08", NA, NA, "#bf006c",

"2019-08-09", NA, NA, "#bf006c",

"2019-08-23", "Final Submission", "#02307a", "#02307a"

)

ggweek_planner(

start_day = "2019-07-01",

highlight_days = project_days

) +

ggplot2::ggtitle("A Very Important Project")

README-project-1.png

Printable Calendars

Here’s a printable calendar of 8 week time periods for 2019 and 2020:

The code chunk below shows how this PDF was created and can be adjusted as needed. I included margins to the left and below the calendar for extra notes.

start_date <- lubridate::floor_date(lubridate::ymd("2019-01-01"), "week", week_start = 1)

end_date <- lubridate::ceiling_date(lubridate::ymd("2019-12-31"), "week", week_start = 1) -

lubridate::days(1)

week_dates <- seq(start_date, end_date, by = "56 day")

pdf(here::here("printable", "2019-weekly-planner.pdf"), width = 8.5, height = 11)

for (idx_week in seq_along(week_dates)) {

gcal <- ggweek_planner(start_day = week_dates[idx_week]) +

ggplot2::theme(plot.margin = ggplot2::margin(1, 2, 3, 0.5, "in")) +

ggplot2::ggtitle(paste(

strftime(week_dates[idx_week], "%B %e, %Y"),

strftime(week_dates[idx_week] + 55, "%B %e, %Y"),

sep = " — "

))

print(gcal)

}

dev.off()

#> png

#> 2

#> png

#> 2

And here are fullpage yearly calendars for 2019 and 2020.

g2019 <- ggweek_planner(

start_day = "2019-01-01",

end_day = "2019-12-31",

show_day_numbers = TRUE,

show_month_boundaries = FALSE,

show_month_start_day = FALSE,

week_start_label = "week"

) +

ggplot2::ggtitle("2019") +

ggplot2::facet_wrap(~ month, scales = 'free')

ggplot2::ggsave(

file = here::here("printable", "2019-full-year.pdf"),

plot = g2019,

width = 11, height = 8.5

)

Please note that the ‘ggweekly’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值