title: Adding text or legend to figure in R - coordinate values
body: <p>So I have just have a simple line plot. I am trying to add a legend and some text to it. However, it doesn't work. The legend and text don't show up no matter what coordinate values I give them - the only way to get the legend to show up is to use 'top right' or 'center' (because the command takes text input as well as coordinate). However, the x,y coordinate system doesn't work. It doesn't give an error, the legend just doesn't show up at all.</p>
  
  <p>Anybody have any idea what is going on here?</p>
  
  <p>Here is some sample code:</p>
  
  <pre><code>plot(x=d[,1],y=d[,2], type='l', xlab='Minor allele frequency', ylab='Power', ylim=range(.5,1))
  lines(x=r[,1],y=r[,2],lty=2)
  legend(2,1,legend=c('Dominant','Recessive')
  text(2.8,1,'Test')
  </code></pre>
  
  <p>The data itself is irrelevant. I just don't understand why the legend won't show up? Or the text? What values are these coordinate values supposed to be? I've tried everything.</p>