title: Multiple x-axis labels for time-series data
body: <p>I am able to plot the time-series data using <code>ggplot2</code>. However, I want to highlight the seasonal information alongwith the time-series data. </p>
  
  <p>Here's my code: </p>
  
  <pre><code>library(zoo)
  library(ggplot2)
  
  a &lt;- read.table(text = "
         Season Quarter  Sales
         Season1  2014Q1  20 
         Season1  2014Q2  40 
         Season1  2014Q3  60 
         Season1  2014Q4  80 
         Season2  2015Q1  30 
         Season2  2015Q2  40 
         Season2  2015Q3  80 
         Season3  2015Q4  90 
         Season3  2016Q1  100 
         Season3  2016Q2  120 
         Season3  2016Q3  140
       ", header = TRUE, sep = "")
  a$Quarter&lt;-as.yearqtr(a$Quarter)
  a$Quarter&lt;-as.Date(a$Quarter)
  
  ggplot(data=a,aes(x=Quarter, y=Sales)) +
         geom_line()
  </code></pre>
  
  <p>This works well in that I am able to draw a time-series data. 
  <a href="https://i.stack.imgur.com/0EwZV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0EwZV.png" alt="plot1"></a></p>
  
  <p>Now, I want to label what constitutes Season 1, 2 etc. One way to do this would be to use <code>color</code> or <code>linetype</code>. However, this doesn't seem to work because it breaks the continuity of the time-series.</p>
  
  <pre><code># doesn't work...
  ggplot(data=a,aes(x=Quarter, y=Sales)) +
         geom_line(aes(linetype=Season))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/9rCUp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9rCUp.png" alt="plot2"></a></p>
  
  <p>On the other hand, I like how Excel plots this graph in <em>just two clicks.</em> It creates a beautiful graph that shows seasonal information on x-axis along with dates. It essentially creates a 3-layered x-axis.</p>
  
  <p><a href="https://i.stack.imgur.com/9Bh2Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Bh2Q.png" alt="plot3"></a></p>
  
  <p>I have two questions on this topic:</p>
  
  <p><strong>Question 1:</strong> Using <code>ggplot</code>, how can I use <code>linetype</code> (or <code>color</code>) in <code>ggplot</code> to create continuous graph (i.e. without breaks)? I'd prefer <code>linetype</code> over <code>color</code>.
  <em>As an example and to answer the comment: here's the graph I created using a different set of data.</em></p>
  
  <pre><code>df &lt;- data.frame(x = 1:3, y = 1:3, z = c(1,3,5))
  ggplot(df, aes(x, y, color = factor(z))) +
         geom_line(aes(group = 1))
  </code></pre>
  
  <p>I am unable to replicate above behavior for time-series data.
  Here's the graph I got from above code: </p>
  
  <p><a href="https://i.stack.imgur.com/31mM9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/31mM9.png" alt="enter image description here"></a></p>
  
  <p><strong>Question 2:</strong> Using <code>ggplot</code>, how can I create a multi-level x-axis (similar to what Excel did for me) that shows Seasonal information with dates? {Please see Excel graph that I created.} I do NOT want to create a legend using this option. I also want to clarify that I'd appreciate if we don't use hacking methods by applying <code>annotate</code> (or possibly <code>geom_text</code>) methods to put these multi-level labels by adjusting and re-adjusting x- and y- values to fit them. This is because it defeats the purpose of using programming language to draw the graph, and it won't work as the data change. </p>
  
  <p>If you have any questions, please let me know. I'd appreciate your thoughts. I am an absolute beginner with <code>ggplot2</code>. It's been only 5 days since I have transitioned from Excel and STATA to <code>ggplot</code>. So, I apologize if my question is too basic.</p>
  
  <p>I researched this topic on SO and couldn't anything that is close enough. For instance, <a href="https://stackoverflow.com/questions/13067012/date-format-for-plotting-x-axis-ticks-of-time-series-data">this thread</a> talks about changing ticks, but not what I am looking for.</p>