Created
June 23, 2011 16:55
-
-
Save jrauser/1042981 to your computer and use it in GitHub Desktop.
Look at your data plots
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
points_per_hour<-2000 | |
layd_raw_transition<- | |
data.frame(timestamp=factor(c(rep(seq(0,11),points_per_hour), | |
rep(seq(12,23),points_per_hour))), | |
latency=c(rgamma(12*points_per_hour,shape=3,scale=60), | |
rgamma(12*points_per_hour*0.9,shape=2,scale=60), | |
rgamma(12*points_per_hour*0.1,shape=8,scale=60)), | |
type=(c(rep("before",12*points_per_hour), | |
rep("after",12*points_per_hour)))) | |
library(ggplot2) | |
# A timeseries of boxplots | |
ggplot(layd_raw_transition,aes(y=latency))+geom_boxplot(aes(x=timestamp,group=timestamp)) | |
# The heatmap | |
ggplot(layd_raw_transition,aes(timestamp,latency))+stat_bin2d(binwidth=c(1,50)) | |
# A "violin" plot. I wanted this to work but it had a nasty Moire effect. | |
ggplot(layd_raw_transition,aes(latency))+ geom_ribbon(aes(ymax=..count../2, ymin=-..count../2,), binwidth=40,stat="bin")+facet_wrap(~timestamp,nrow=1)+coord_flip() | |
# Faceted frequency polygons | |
ggplot(layd_raw_transition,aes(latency))+geom_freqpoly(binwidth=20)+facet_wrap(~type,ncol=1) | |
# Boil down into a time series | |
layd_ts_transition<-ddply(layd_raw_transition,"timestamp", summarize, avg_latency=mean(latency), count=length(latency)) | |
# The timeseries I showed in the preso | |
ggplot(layd_ts_transition,aes(timestamp,avg_latency))+ | |
geom_line(aes(group=1),size=3,color="#92959c")+ | |
geom_point(size=5,shape=15,colour="#4f4e5f")+ | |
scale_x_discrete(breaks=seq(0,23,4))+ | |
ylim(0,200)+xlab("Time")+ylab("Average Latency (ms)") | |
# The heatmap chart I showed in the preso | |
ggplot(layd_raw_transition,aes(timestamp,latency))+stat_bin2d(binwidth=c(1,50))+ | |
geom_line(data=layd_ts_transition,aes(timestamp,avg_latency,group=1),size=3,color="#92959c")+ | |
scale_x_discrete(breaks=seq(0,23,4))+ | |
xlab("Time")+ylab("Average Latency (ms)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment