Skip to content

Instantly share code, notes, and snippets.

@ifesdjeen
Created May 1, 2013 20:27
Show Gist options
  • Save ifesdjeen/5498093 to your computer and use it in GitHub Desktop.
Save ifesdjeen/5498093 to your computer and use it in GitHub Desktop.
Render dot-plot of Keystrokes by minute
setwd("~/analytics/")
kp = read.csv("grouped_keys_combined")
colnames(kp) = c("Day", "Minute", "Strokes")
attach(kp)
parseTimestamp <- function(ts) as.POSIXct((ts + 120*60*1000) / 1000, origin="1970-01-01", tz="CEST")
kp$DayParsed <- parseTimestamp(kp$Day)
head(kp$DayParsed)
library("ggplot2")
ggplot(kp, aes(x = kp$DayParsed, y = kp$Minute, color = kp$Strokes)) +
geom_point() +
scale_x_datetime(
breaks = scales::date_breaks("1 day"),
labels = scales::date_format("%A, %b %d")) +
scale_y_continuous(
breaks = c(0, 540, 720, 960, 1080, 1320, 1440),
labels = c("Midnight2", "9AM", "Noon", "4PM", "6PM", "10PM", "Midnight"),
limits=c(0, 1440))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment