title: How can you use directlabels and ggplot2?
body: <p>I'm trying use the <a href="http://directlabels.r-forge.r-project.org/" rel="nofollow noreferrer">directlabels</a> package to label two lines I have in a simple plot (I'm using <a href="http://had.co.nz/ggplot2/" rel="nofollow noreferrer">ggplot2</a>)</p>
  
  <p><img src="https://i.stack.imgur.com/fYdkX.png" alt="enter image description here"></p>
  
  <p>My code is as follows:</p>
  
  <pre><code># libraries
  library(ggplot2)
  library(directlabels)
  
  # Variables
  A = array(1000,100)
  F = seq(length=100, from=0, by=10)
  f = array(5,100)
  
  # make data frame 1
  df &lt;- data.frame(X = F * f/A, Y = F/A)
  
  # plot line 1
  p = ggplot(df, aes(x=X,y=Y)) 
  p = p + geom_line(colour="#56B4E9") 
  
  # make data frame 2
  df1 &lt;- data.frame(X = F * f * 2/A, Y = F/A)
  
  # plot line 2
  p =  p + geom_line(aes(x=X,y=Y), data=df1, colour="#56B4E9")    
  
  # label line
  direct.label(p, 'last.points')
  </code></pre>
  
  <p>However I get the following error message:</p>
  
  <pre><code>Error in direct.label.ggplot(p, "last.points") : 
    Need colour aesthetic to direct label.
  </code></pre>
  
  <p>I've tried adding several arguments to the <code>direct.label()</code> function, but I don't understand what aesthetic argument should be used.</p>