title: Plotting median alongside multiple lines in a line plot in R
body: <p>I have some data (temperatre per different battery levels) for users of a mobile app. I would like to plot the data for each user (all in a single line plot) as well as the median of <code>temp</code> for similar <code>percentage</code>s for all users (in the same graph, highlighting it using a thicker line). I can plot all lines except the median using ggplot2. Here is my dummy data file (I can change the data organization/structure or group my data if I need to):</p>
  
  <pre><code>userId, percentage, temp
  11, 2, 32
  11, 3, 32
  11, 4, 33
  11, 5, 33
  11, 7, 34
  11, 10, 30
  12, 2, 30
  12, 3, 30
  12, 4, 30
  12, 5, 30
  12, 7, 34
  12, 10, 32
  </code></pre>
  
  <p>Here is how I do it at the moment:</p>
  
  <pre><code>library(ggplot2)
  sampleDataFrame &lt;- read.table(file.choose(), sep=",", header=T)
  sampleDataFrame$userId &lt;- factor(sampleDataFrame$userId)
  p1 &lt;- ggplot(sampleDataFrame, aes(x=percentage, y=temp, colour=userId)) + geom_line()
  print(p1)
  </code></pre>
  
  <p>Here is the result:</p>
  
  <p><a href="https://i.stack.imgur.com/R4r6V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R4r6V.png" alt="line plot"></a></p>