Skip to content

Instantly share code, notes, and snippets.

@steveharoz
Created January 18, 2013 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveharoz/4561358 to your computer and use it in GitHub Desktop.
Save steveharoz/4561358 to your computer and use it in GitHub Desktop.
library(ggplot2)
yDistribution <- function(x) { return(1/x) }
xSampleDistribution <- function(x) { return((2 ^ x) * 10) }
x <- c()
y <- c()
for (i in 0:8) {
sampleCount <- xSampleDistribution(i)
x <- c(x, rep(i, sampleCount))
y <- c(y, yDistribution(runif(sampleCount)))
}
df <- data.frame(list(x=6-x, y=y))
ggplot(df) +
geom_point(aes(x=x, y=y), position = position_jitter(w = 1, h = 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment