Created
June 23, 2011 17:10
-
-
Save adamf/1043012 to your computer and use it in GitHub Desktop.
Experiments in R
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
# generate the distribution data and melt appropriately | |
k = rbind(t(replicate(100, rnorm(100,10,2))), t(replicate(100, rchisq(100,5, 2)))) | |
s = t(apply(k, 1, summary)) | |
foo = melt(s) | |
bar = melt(k) | |
# a plot of the smoothed data | |
ggplot(bar, aes(y=value, x=X1)) + geom_smooth() + ylab("milliseconds") + xlab("time") | |
# a plot of the summary data and the smoothed data | |
# remove + geom_smooth() if you find it ugly (i do!) | |
ggplot(foo, aes(X1, value, group=X2, color=X2)) + geom_line() + geom_smooth() + ylab("milliseconds") + xlab("time") | |
# a plot akin to @jrauser's | |
ggplot(bar, aes(X1, value, color=abs(value-mean(value)))) + stat_bin2d() + scale_color_gradient() + geom_smooth() + ylab("milliseconds") + xlab("time") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment