Skip to content

Instantly share code, notes, and snippets.

@stephenjbarr
Created February 23, 2014 18:11
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 stephenjbarr/9175008 to your computer and use it in GitHub Desktop.
Save stephenjbarr/9175008 to your computer and use it in GitHub Desktop.
library(ggplot2)
pts = cartesian_product(c('x','y'))
d1 = cbind(pts, runif(nrow(pts),min=0,max=1), 1)
d2 = cbind(pts, runif(nrow(pts),min=0,max=4), 2)
colnames(d1) = colnames(d2) = c("x","y","val","k")
d = rbind(d1,d2)
p1 <- ggplot(d1, aes(x = x, y = y, fill = val))
p1 <- p1 + geom_tile()
p1 <- p1 + scale_fill_gradient2()
p2 <- ggplot(d2, aes(x = x, y = y, fill = val))
p2 <- p2 + geom_tile()
p2 <- p2 + scale_fill_gradient2()
## how do I make p1 and p2 have the same sacle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment