title: r - Add a 2nd x axis to a ggplot
body: <p>I ran a simulation for some populations. Now I want to plot the change of particular characteristics of these population over time as a line plot. The common x axis shows the number of generation</p>
  <p>Below is a minimum working example for my R code so far (dummy data):</p>
  <pre class="lang-r prettyprint-override"><code>require(ggplot2)
  
  set.seed(3)
  x &lt;- 99:0
  y &lt;- 0.5+cumsum(rnorm(100, 0, 0.01))
  xy &lt;- data.frame(x,y)
  
  ggplot(data=xy, aes(x=x, y=y)) +
     geom_line() +
     xlab(&quot;Generation number&quot;) +
     ylab(&quot;Character&quot;)
  </code></pre>
  <p>However, now I'd like to add a second x axis which gives the number of years before present (BP), assuming that the average generation time is 22.5 years. Thus, the value for the lowest generation number will have the highest value in the 2nd axis and vice versa. Any idea how I could acchieve this?</p>
  <p>Thanks a lot in advance for your suggestions and help!</p>