This post is to create a calendar.
This post is to create a calendar to check when some events were more likely to occur.
Create a data frame with a sequence of days
firstday<- as.Date("2020-05-01")
lastday <- as.Date("2020-08-31")
days_seq <- seq(firstday, lastday, by = "day")
days_df<-as.data.frame(days_seq)
Separate months and days
Add values
Separate months
Create x and y axis
may$calen_xs<-calen_xs[1:31]
may$calen_ys<-calen_ys[1:31]
Select color palette
my_palette <- c("1" = '#577590',
"2" = '#43aa8b',
"3" = '#90be6d',
"4" = "#f9c74f",
"5" = "#f8961e",
"6" = "#f3722c",
"7" = "#f94144")
ggplot(may,aes(x=calen_xs,y=calen_ys,color=events))+
geom_point(size=25,shape=15)+
scale_x_continuous(limits=c(0.5,7.5))+
scale_y_continuous(limits=c(0.5,5.5))+
# remove background colors
theme_void()+
# adds texts
geom_text(aes(label=day),color='white') +
# sets the legend below
theme(legend.position = 'top')+
# lines the legend
guides(colour = guide_legend(override.aes = list(size=6),nrow = 1))+
# uses palette
scale_color_manual(name = "May no. events",values = my_palette)