title: Mimic filled.contour with ggplot
body: <p>I've been trying to mimic the output of <code>filled.contour</code> with ggplot's <code>geom_tile</code> and <code>geom_raster</code>. There seems to be some interpolation or something behind the scenes of <code>filled.contour</code> to fill in the gaps, especially in y-axis. Any idea how to make similar, nice looking plot with ggplot?</p>
  
  <p>Data for example can be downloaded <a href="http://www.sharecsv.com/s/9c4302cbf5c24701b73a98c01451e175/data.csv" rel="nofollow noreferrer">here</a> (ShareCSV link).</p>
  
  <p>Code for example:</p>
  
  <pre><code>library("ggplot2")
  library("reshape2")
  
  
  file &lt;- file.choose()
  data &lt;- read.csv(file, stringsAsFactors=FALSE, header=TRUE,
                   colClasses=c("POSIXct", rep("numeric", 12)),
                   check.names=FALSE)
  
  palette &lt;- colorRampPalette(c("darkblue", "blue", "lightblue1",
                                "green", "yellow", "red", "darkred"))
  
  # GGplot version
  df &lt;- melt(data, id.vars="Time", measure.vars=names(data)[-1])
  names(df)[2:3] &lt;- c("Channel", "Value")
  df$Channel &lt;- log10(as.numeric(as.character(df$Channel)))
  df$Value &lt;- log10(df$Value)
  
  
  p &lt;- ggplot(data=df, aes(x=Time, y=Channel, fill=Value)) +
    # geom_tile() +
    geom_raster() +
    scale_y_continuous(expand=c(0, 0)) +
    scale_x_datetime(expand=c(0, 0)) +
    scale_fill_gradientn(colours=palette(100)) +
    theme_bw()
  
  p
  
  # Base version
  Channel &lt;- log10(as.numeric(names(data[-1])))
  Value &lt;- log10(data.matrix(data[, -1]))
  
  filled.contour(x=data$Time, y=Channel, z=Value,
                 color.palette=palette, nlevels=100)
  </code></pre>
  
  <p>I tried the following for <code>df</code> and it got pretty close but it's very compute intensive.</p>
  
  <pre><code>library("akima")
  
  interpolation &lt;- with(df, interp(x=Time, y=Channel, z=Value,
                        xo=seq(min(Time), max(Time), length.out=nrow(data)),
                        duplicate="mean"))
  
  df&lt;- interp2xyz(interpolation, data.frame=TRUE)
  names(df) &lt;- c("Time", "Channel", "Value")
  df$Time &lt;- as.POSIXct(df$Time, origin="1970-01-01")
  </code></pre>
  
  <p>Outcome:</p>
  
  <p><a href="https://i.stack.imgur.com/mRRP4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mRRP4.png" alt="enter image description here"></a></p>