title: ggplot2: how to color a graph by multiple variables
body: <p>I am fairly certain I have seen a solution for this somewhere, but as I have been unable to find it, here is my problem. </p>
  
  <p>I have some time series data identified by multiple variables, I would like to be able to graph and differentiate color using multiple variables in <code>ggplot2</code>.</p>
  
  <p>Sample data:</p>
  
  <pre><code>date &lt;- c("2016-04-01 UTC", "2016-05-01 UTC", "2016-06-01 UTC", "2016-04-01 UTC",
            "2016-05-01 UTC", "2016-06-01 UTC", "2016-04-01 UTC", "2016-05-01 UTC",
            "2016-06-01 UTC", "2016-04-01 UTC")
  temp &lt;- c(80.24018,  85.88911, 104.23125,  85.13571,  91.21129, 104.88333,  97.81116,
            107.40484, 121.03958,  87.91830)
  id &lt;- c("A","A","A","A","A","B","B","B","B","B")
  location &lt;- c("N","S","S","N","N","S","N","S","N","S")
  
  df &lt;- data.frame(date,temp,id,location)
  </code></pre>
  
  <p>My attempt at graphing </p>
  
  <pre><code>library(ggplot2)
  
  ggplot(df) + 
    geom_line(aes(x=date,y=temp,colour=factor(location), group=interaction(location,id)))
  </code></pre>
  
  <p>Using this code it is only coloring by location. I would like to the lines to be colored by location and id.</p>