Skip to content

Instantly share code, notes, and snippets.

@adamf adamf/gist:1043012

Created Jun 23, 2011
What would you like to do?
Experiments in R
# 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
You can’t perform that action at this time.