Skip to content

Instantly share code, notes, and snippets.

@cavedave
Created March 30, 2021 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cavedave/9c151a4a15a657249bd94112a4a36f3d to your computer and use it in GitHub Desktop.
Save cavedave/9c151a4a15a657249bd94112a4a36f3d to your computer and use it in GitHub Desktop.
visualisation of when cherry blossoms peak in kyoto
#data from https://datagraver.com/case/kyoto-cherry-blossom-full-flower-dates#google_vignette
df <- read.csv(file ="kyoto_dates_cherryblossom2021.csv")
library(tidyverse)
df<-df %>% drop_na()
library(lubridate)
df<-df %>% select(Year, Month, Day) %>%
mutate(date2 = make_date(Year, Month, Day))
df <- df %>%
mutate(dated = yday(date2))
library(ggplot2)
library(ggthemes)
#mydata = read.csv("/Users/davidcurran/Documents/pythonText/course4_downloads/cleanCherry.csv")
ggplot(df, aes(Year, dated)) +
theme_update(plot.title = element_text(hjust = 0.5))+
theme_tufte() +
geom_point(color='#d498a3') +
geom_smooth(color='darkred')+
ggtitle("When Cherry Blossoms Peak in Kyoto")+
#theme(plot.title = element_text(hjust = 0.5)+
ylab("Day of Year")+
annotate("segment", x = 798, xend = 798, y = 85, yend = 90, colour = "wheat1", size=3) +
annotate("text", x = 798, y = 87.5, label = "March", size = 3.0,angle = 90)+
annotate("segment", x = 798, xend = 798, y = 90.2, yend = 120, colour = "wheat2", size=3) +
annotate("text", x = 798, y = 105.5, label = "April", size = 3.0,angle = 90)+
annotate("segment", x = 798, xend = 798, y = 120.2, yend = 130, colour = "wheat3", size=3) +
annotate("text", x = 798, y = 125.5, label = "May", size = 3.0,angle = 90)+
#annotate("segment", x = 800, xend = 820, y = 80, yend = 90, colour = "wheat4", size=.5) +
annotate("text", x = 1600, y = 85, label = "@iamreddave data:kyotofullflower@public", size = 3.0)+
annotate("text", x = 1525, y = 129.5, label = "Latest", size = 3.0)+
annotate("text", x = 2000, y = 86.5, label = "2021 earliest", size = 3.0)+
theme(plot.title = element_text(hjust = 0.5))
#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'
ggsave("cherry2021.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment