Skip to content

Instantly share code, notes, and snippets.

@mbusigin
Last active August 29, 2015 14:03
Show Gist options
  • Save mbusigin/88c8bd6cdc4febc365f1 to your computer and use it in GitHub Desktop.
Save mbusigin/88c8bd6cdc4febc365f1 to your computer and use it in GitHub Desktop.
Chronographically coloured, pathed scatter plot
##
## Creates graphs like:
## https://twitter.com/mbusigin/status/483370672828055553
##
colourized_scatter <- function(a)
{
plot(matrix(a, ncol=2), type="l", xlab=names(a)[1], ylab=names(a)[2])
points(matrix(a, ncol=2), col=rainbow(nrow(a)), pch=16, cex=.5)
lines(lowess(a), lty=3)
m = lm(a[,2] ~ a[,1])
abline(m, lty=3)
grid()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment