Created
October 28, 2018 05:44
-
-
Save emitanaka/b54f75195d2b4122be9a9b8c55054076 to your computer and use it in GitHub Desktop.
Emoji Calendar Plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(lubridate) | |
library(sugrrants) | |
library(emojifont) | |
load.emojifont('OpenSansEmoji.ttf') | |
happy <- c("\U0001f606", "\U0001f603", "\U0001f64b", "\U0001f604", "\U0001f600") | |
sad <- c("\U0001f63f", "\U0001f622", "\U0001f62d", "\U0001f61e", "\U0001f64d") | |
neutral <- c("\U0001f47e", "\U0001f43a", "\U0001f438") | |
mths <- c("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC") | |
set.seed(1) | |
feeling <- function() { | |
status <- c(emo::ji("happy"), emo::ji("sad"), sample(neutral, 1)) | |
sample(status, 1) | |
} | |
emocal18 <- tibble( | |
date = seq(as.Date("2018-01-01"), as.Date("2018-12-31"), by = 1), x = 0L, y = 0L) %>% | |
mutate(emoticon=replicate(365, feeling())) %>% | |
mutate(emoticon=case_when(day(date)==1 ~ toupper(format(date, "%b")), | |
yday(date) > yday(Sys.Date()) ~ "", | |
TRUE ~ emoticon)) %>% | |
mutate(status=case_when(emoticon %in% happy ~ "happy", | |
emoticon %in% sad ~ "sad", | |
emoticon %in% mths ~ "month", | |
TRUE ~ "neutral")) | |
quartz() | |
emocal18 %>% | |
ggplot(aes(x, y, label = emoticon, colour = status)) + | |
geom_text(size = 10, family="OpenSansEmoji") + | |
facet_calendar(date = date, format = "%e", week_start = 7, ncol = 4) + | |
labs( | |
x = "", y = "", | |
title = "2018 Emoticon Calendar", | |
caption = "using sugrrants R-package by Earo Wang" | |
) + | |
theme( | |
strip.background = element_rect(fill = "#881EE4"), | |
panel.background = element_rect(fill = "black"), | |
strip.text = element_text(colour = "#FFFFFF", size=20), | |
axis.ticks = element_blank(), | |
axis.text = element_blank(), | |
panel.grid = element_blank(), | |
plot.title = element_text(size=28), | |
plot.caption=element_text(size=20) | |
) + | |
scale_colour_manual(values = c(`happy` = "#3ef42d", `sad` = "#F42D2D", `neutral`="#2de5f4", `month`="#FFFFFF")) + | |
guides(colour = "none") |
Author
emitanaka
commented
Oct 28, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment