Last active
May 3, 2019 07:39
-
-
Save akshat3096/c00403ccbb73033bafbed6792cc12c97 to your computer and use it in GitHub Desktop.
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
# calendar heatmap: year wise calories burned | |
f <- df %>% | |
filter(type == 'HKQuantityTypeIdentifierActiveEnergyBurned') %>% | |
filter(year==2018) %>% | |
mutate(week_date = ceiling(day(creationDate) / 7)) %>% | |
group_by(week_date, month, dayofweek) %>% | |
summarise(total_cal = sum(value)) | |
p <- ggplot(f, | |
aes(dayofweek, week_date, fill = f$total_cal)) + | |
geom_tile(colour = "white") + | |
facet_wrap(~month) + | |
theme_bw() + | |
scale_fill_gradient(name = "Total \nCalories", | |
low ="#56B1F7" , high = "#132B43") + | |
labs(x = "Week of the Month", | |
y = "Week number") + | |
scale_y_continuous(trans = "reverse") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment