title: How to create a faceted line-graph using ggplot?
body: <p>I have a data frame created with this code:</p>
  
  <pre><code>require(reshape2)
  foo &lt;- data.frame( abs( cbind(rnorm(3),rnorm(3, mean=.8),rnorm(3, mean=.9),rnorm(3, mean=1))))
  qux &lt;- data.frame( abs( cbind(rnorm(3),rnorm(3, mean=.3),rnorm(3, mean=.4),rnorm(1, mean=2))))
  bar &lt;- data.frame( abs( cbind(rnorm(3,mean=.4),rnorm(3, mean=.3),rnorm(3, mean=.9),rnorm(3, mean=1))))
  
  colnames(foo) &lt;- c("w","x","y","z")
  colnames(qux) &lt;- c("w","x","y","z")
  colnames(bar) &lt;- c("w","x","y","z")
  
  rownames(foo) &lt;- c("n","q","r")
  rownames(qux) &lt;- c("n","q","r")
  rownames(bar) &lt;- c("n","q","r")
  
  foo &lt;- cbind(ID=rownames(foo),foo)
  bar &lt;- cbind(ID=rownames(bar),qux)
  qux &lt;- cbind(ID=rownames(bar),qux)
  
  foo$fn &lt;- "foo"
  qux$fn &lt;- "qux"
  bar$fn &lt;- "bar"
  
  alldf&lt;-rbind(foo,qux,bar)
  alldf.m &lt;- melt(alldf)
  </code></pre>
  
  <p>What I want to do is to create a <code>ggplot</code> line curve in <em>facet</em> format, so it creates a graph like this:</p>
  
  <p><img src="https://i.stack.imgur.com/pbQvs.jpg" alt="enter image description here"></p>
  
  <p>The actual graph does not contain upward lines - this is just a sketch so that the line separation is clear. </p>
  
  <p>My current code doesn't work:</p>
  
  <pre><code>    library(ggplot2)
      p &lt;- ggplot(data=alldf.m, aes(x=variable)) + 
             geom_line(aes(colour=ID),alpha=0.4)
      p &lt;- p + facet_wrap( ~ fn)
      p
  </code></pre>
  
  <p>What's the best way to do it?</p>