title: Normalizing series for plotting in ggplot2
body: <p>I have a dataframe that I would like to plot, generated by the following code.</p>
  
  <pre><code>df_rn1 = as.data.frame(cbind(rnorm(40, 1, 1), rep("rn1", 40)))
  df_rn2 = as.data.frame(cbind(rnorm(40, 10, 1), rep("rn2", 40)))
  df_rn3 = as.data.frame(cbind(rnorm(40, 100, 1), rep("rn3", 40)))
  
  df_test = rbind(df_rn1, df_rn2, df_rn3)
  colnames(df_test) &lt;- c("value", "type")
  </code></pre>
  
  <p>I would like to plot the dataframe normalized by the respective first observation s.t. they are scaled properly. However, I am not getting further than this:</p>
  
  <pre><code>ggplot(aes(x = rep(1:40, 3), y=as.numeric(as.character(value)), color = type), data = df_test) +
        geom_line()
  </code></pre>
  
  <p>Is it possible to do the normalization by types directly in the ggplot code?</p>
  
  <p>Thx</p>