Margin adjustments when using ggplot's geom_tile()

Posted by chris_dubois on Stack Overflow See other posts from Stack Overflow or by chris_dubois
Published on 2010-05-10T19:42:10Z Indexed on 2010/05/10 19:44 UTC
Read the original article Hit count: 185

Filed under:
|

From the documentation for ggplot2's geom_tile() function, we have the following simple plot: alt text

> # Generate data 
> pp <- function (n,r=4) { 
+  x <- seq(-r*pi, r*pi, len=n) 
+  df <- expand.grid(x=x, y=x) 
+  df$r <- sqrt(df$x^2 + df$y^2) 
+  df$z <- cos(df$r^2)*exp(-df$r/6) 
+  df 
+ } 
> p <- ggplot(pp(20), aes(x=x,y=y)) 
>  
> p + geom_tile()

How do I remove the margins that border the tile?

© Stack Overflow or respective owner

Related posts about r

    Related posts about ggplot2