Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PatrickStotz
PatrickStotz / steps_2024.R
Last active January 19, 2025 10:46
Plotting daily step count as a radial chart in R/ggplot
####### Package management #######
## install and load needs, if not yet present
# install.packages("needs")
# library(needs)
## packages used in this markdown document
## install these packages from github
# devtools::install_github("mrkaye97/fitbitr")
# devtools::install_github("AllanCameron/geomtextpath")
needs(tidyverse, viridis, fitbitr, geomtextpath)
@PatrickStotz
PatrickStotz / TomTom Congestion-Index
Created March 25, 2020 10:54
Scraping TomTom Congestion data
needs(tidyverse, jsonlite, lubridate)
cities = c("frankfurt-am-main", "cologne", "berlin", "hamburg", "munich")
for (city in cities){
url = paste0("https://api.midway.tomtom.com/ranking/live/DEU%2FCircle%2F", city)
data = fromJSON(url)
table = data$data %>%
select(TrafficIndexLive, TrafficIndexHistoric, UpdateTime) %>%
mutate(time = as_datetime(UpdateTime / 1000)) %>%
@PatrickStotz
PatrickStotz / README.md
Last active September 10, 2024 03:22
Spinning globe with glowing city markers in D3

A Spinning globe with glowing city markers in D3.

Note: This visualization constantly recalculates and reprojects the position of over 4000 markers and thus needs a lot of computation power. Older computer and mobile devices might struggle with the rendering process. Furthermore the visualization is only optimized for Chrome browsers and might look different than expected when opened in other browsers.

Inspired by Curran Kelleher's idea to plot a world map in D3 by using the GeoNames database as seen in his great Introdction to D3 video.