GithubHelp home page GithubHelp logo

tchigher / calendr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from r-coderdotcom/calendr

0.0 0.0 0.0 137 KB

Ready to print calendars with ggplot2

License: GNU General Public License v2.0

R 100.00%

calendr's Introduction

calendR R package

Ready to print monthly and yearly calendars made with ggplot2

๐Ÿ“… The calendars will be created by default in the system locale.

๐Ÿ“– Check the full calendR package tutorial.

Index

Installation

GitHub

# Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("R-CoderDotCom/calendR")

CRAN

install.packages("calendR")

CRAN_Status_Badge CRAN_Downloads

Yearly calendar

library(calendR)
calendR() # Defaults to the current year

Calendar_2020

calendR(mbg.col = 2,           # Background color for the month names
        months.col = "white",  # Text color of the month names
        special.days = c(1, 50, 12, 125, 80,     # Color days of the year
                         99, 102, 205, 266, 360),
        special.col = "pink", # Color of the special.days
        months.pos = 0.5)      # Horizontal alignment of the month names

calendR

Monthly calendar

calendR(year = 2028, month = 1)

Calendar_enero_2028

calendR(month = 7, year = 2022, 
        special.days = c(1, 5, 12, 28),       # Color days of the month
        text = "Visit\nhttps://r-coder.com/", # Add some text
        text.pos = c(1, 5, 12, 28))           # Where to add the text

Calendar_julio_2022

Custom start and end date

calendR(start_date = "2020-09-01", end_date = "2021-05-31", lty = 0, title = "2020-2021", start = "M")

imagen

Start of the week (Monday or Sunday)

# calendR(month = 1, start = "S") # Week starts on Sunday (default)
calendR(month = 1, start = "M")   # Week starts on Monday

Calendar_enero_2020

Orientation ("landscape" or "portrait")

# calendR(year = 2021, orientation = "landscape") # Default
calendR(year = 2021, orientation = "portrait")

Calendar_2021

Calendar heatmap (Gradient)

calendR(year = 2021, special.days = 1:365,
        gradient = TRUE,        # Needed to create the heat map
        special.col = rgb(1, 0, 0, alpha = 0.6), # Higher color
        low.col = "white")                       # Lower color

Calendar_2021_GRADIENT

Add several events

# Vector of NA which length is the number of days of the year or month
myfills <- rep(NA, 366)

# Add the events to the desired days
myfills[c(1:4, 50, 300:315)] <- "Holidays"
myfills[16] <- "Birthday"


calendR(special.days = myfills,
        special.col = 2:3,     # Add as many colors as events
        legend.pos = "right")  # Add a legend if desired

imagen

Add background image

calendR(mbg.col = 4,                # Background color for the month names
        months.col = "white",      # Text color of the month names
        special.days = "weekend",  # Color the weekends
        special.col = "lightblue", # Color of the special.days
        lty = 0,                   # Line type
        weeknames = c("Mo", "Tu",  # Week names
                      "We", "Th",
                      "Fr", "Sa",
                      "Su"),
        title.size = 30,   # Title size
        orientation = "p", # Portrait orientation
        start = "M",       # Start the week on Mondays
        bg.img = "https://i.pinimg.com/originals/10/1e/f6/101ef6a9e146b23de28fa2cd568ad17b.jpg")  # Image

Lunar calendar

calendR(month = 1,  
        lunar = TRUE,         # Add moons to monthly calendar
        lunar.col = "gray60", # Color of the non-visible area of the moon
        lunar.size = 7)       # Size of the moons

imagen

Save as PDF (as A4 paper size)

calendR(year = 2021, orientation = "portrait", pdf = TRUE)

# Specify a custom document name
calendR(year = 2021, orientation = "portrait", pdf = TRUE, doc_name = "My_calendar")

Further customization

Example 1

calendR(year = 2022,                             # Year
        mbg.col = 2,                             # Background color for the month names
        months.col = "white",                    # Text color of the month names
        special.days = c(1, 50, 12, 125, 80,     # Color days of the year
                          99, 102, 205, 266, 359),
        special.col = "pink",                    # Color of the special.days
        months.pos = 0.5,                        # Center the month names
        lty = 0,                                 # Line type
        weeknames = c("Mo", "Tu", "We", "Th",    # Week names
                      "Fr", "Sa","Su"), 
        bg.col = "#f4f4f4",                      # Background color
        title.size = 60,                         # Title size
        orientation = "p")                       # Orientation

Example 2

calendR(year = 2020,                        # Year
        month = 10,                         # Month
        title = "My calendar",              # Change the title
        subtitle = "Have a nice day",       # Add a subtitle (or motivational phrase)
        subtitle.col = 3,                   # Color of the subtitle
        weeknames = c("S", "M", "T", "W",   # Change week day names
                      "T", "F", "S"), 
        bg.col = "white",                   # Background color
        special.days = "weekend",           # Colorize the weekends (you can also set a vector of days)
        special.col = rgb(0, 0, 1, 0.15),   # Color of the special days
        text = "Running",                   # Add text (only for monthly calendars)
        text.pos = c(7, 14, 25))            # Days of the month where to put the texts       

Calendar_octubre_2020

Example 3 (only on the GitHub development version)

calendR(start_date = "2020-09-01", # Custom start date
        end_date = "2021-05-31",   # Custom end date
        mbg.col = 4,               # Background color for the month names
        months.col = "white",      # Text color of the month names
        special.days = "weekend",  # Color the weekends
        special.col = "lightblue", # Color of the special.days
        lty = 0,                   # Line type
        weeknames = c("Mo", "Tu",  # Week names
                      "We", "Th",
                      "Fr", "Sa",
                      "Su"),
        bg.col = "#f4f4f4",         # Background color
        title = "Academic calendar 2020-2021", # Title
        title.size = 30,                       # Title size
        orientation = "p", # Portrait orientation
        start = "M")       # Start of the week
# See all the arguments of the function for full customization of the colors, text size and style.

calendr's People

Contributors

r-coderdotcom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.