view code/notewise-pitcherror-plots.R @ 0:b31cc68e6234

added code and data from development repository
author Matthias Mauch <mail@matthiasmauch.net>
date Wed, 15 Jul 2015 12:06:53 +0100
parents
children
line wrap: on
line source
source("load-and-merge.R")

for (piece.no in 1:3)
{
  pdf(sprintf("../images/pitcherror_piece%d.pdf", piece.no),
      width = 12, height = 2.3)
  par(mar=c(2,4,.2,.2))
  subs <- subset(tsom, subset=tsom$Piece==piece.no)
  med <- aggregate(subs$Triangle7, list(subs$NoteNoInRun), median)
  q1 <- aggregate(subs$Triangle7, list(subs$NoteNoInRun), function(x){quantile(x,0.25)})
  q3 <- aggregate(subs$Triangle7, list(subs$NoteNoInRun), function(x){quantile(x,0.75)})
  plot(med, pch = 19, ylim = 1.5*c(-1,1), xlab = "note in run", ylab = "semitones",
       las = 1)
  grid()
  for (i in 1:nrow(med))
  {
    lines(i*c(1,1), c(q1[i,2],q3[i,2]), lwd = 3)
  }
  dev.off()
}