title: How to show labels inside a chart with R-plot?
body: <p>I have the following chart in R:</p>
  <pre><code>n = 1:50
  f = log2(n)
  g = n
  h = n*log2(n)
  k = n^2
  z = 2^n
  w = factorial(n)
  plot(n, f, ylim=c(0,200), t='l', col=3)
  lines(n, g, t='l', col=2)
  lines(n, h, t='l', col=3)
  lines(n, k, t='l', col=4)
  lines(n, z, t='l', col=5)
  lines(n, w, t='l', col=6)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/8MCeO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8MCeO.png" alt="enter image description here" /></a></p>
  <p>Is there a way to show the names/labels of each of the functions similar to the following figure:</p>
  <p><a href="https://i.stack.imgur.com/i1JRn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i1JRn.png" alt="enter image description here" /></a></p>