Yearly calendar in ggplot2





Yearly calendar

You can create a yearly calendar in R with the calendR package. Specify the year in the year argument. If no year is specified a calendar of the current year will be created.

# install.packages("calendR")

# Specify the year
calendR(year = 2020)

Yearly calendar in R

Portrait mode

Vertical calendar in ggplot2

The default calendar is in horizontal mode (three rows and four columns), but the orientation argument allows you to to create a vertical calendar with three columns and four rows setting the argument to "p" or "portrait".

# install.packages("calendR")

# Vertical calendar
calendR(orientation = "p")

Further customization

You can also customize more arguments to modify the background color of the months name, the color of some days, the adjustment of the month names, among others. Type ?calendR for the full list.

# install.packages("calendR")

calendR(year = 2021,                             # 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, 360),
        special.col = "pink",                    # Color of the special.days
        months.pos = 0.5)                        # Horizontal alignment of the month names

Calendar customization in R

Storytelling with Data

A Data Visualization Guide for Business Professionals

Buy on Amazon
Better Data Visualizations

A Guide for Scholars, Researchers, and Wonks

Buy on Amazon
Data Sketches

A journey of imagination, exploration, and beautiful data visualizations

Buy on Amazon

See also