Skip to content

Instantly share code, notes, and snippets.

@pedroj
Created March 25, 2013 16:31
Show Gist options
  • Select an option

  • Save pedroj/5238461 to your computer and use it in GitHub Desktop.

Select an option

Save pedroj/5238461 to your computer and use it in GitHub Desktop.
Scatter plot smooth
library("geneplotter") ## from BioConductor
require("RColorBrewer") ## from CRAN
x1 <- matrix(rnorm(1e4), ncol=2)
x2 <- matrix(rnorm(1e4, mean=3, sd=1.5), ncol=2)
x <- rbind(x1,x2)
layout(matrix(1:4, ncol=2, byrow=TRUE))
op <- par(mar=rep(2,4))
smoothScatter(x, nrpoints=0)
smoothScatter(x)
smoothScatter(x, nrpoints=Inf,
colramp=colorRampPalette(brewer.pal(9,"YlOrRd")),
bandwidth=40)
colors <- densCols(x)
plot(x, col=colors, pch=20)
par(op)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment