title: Plot quarterly data and specify quarters using ggplot in rstudio
body: <p>I want to plot quarterly data, where the information is saved in the variable yq as: YYYY Q (e..g 2007 Q1), I created by combining Year and Quarter (1, 2, 3, 4):</p>
  <pre><code>df$yq = as.yearqtr(paste(df$Year, df$Quarter), &quot;%Y %q&quot;)
  </code></pre>
  <p>Looking around on the examples online, I wrote this code but the problem is that it does not let me specify the years I want to display on the x-axis - or rather I can't seem to find a way to apply the breaks for this type of data. I have 15 years of data and would like to only display the label every 3 years, so that the only labels are 2005.Q1, 2008.Q1, 2011.Q1, 2014.Q1, 2017.Q1.</p>
  <p>Grateful for tips!</p>
  <pre><code>plot = ggplot(df, aes(x = yq, y = rate, color = &quot;red&quot;)) +
    geom_point() +
    geom_line(aes(y = lin, color = &quot;green&quot;), size = 1) +
    geom_line(aes(y = quad, color = &quot;brown&quot;), size = 1) +
    geom_line(aes(y = cube, color = &quot;blue&quot;), size = 1) +
    geom_line(aes(y = log, color = &quot;pink&quot;), size = 1) +
    geom_line(aes(y = power_corr, color = &quot;black&quot;), size = 1) +
    geom_line(aes(y = exp_corr, color = &quot;yellow&quot;), size = 1) +
    scale_color_identity(name = &quot;Models&quot;,
                         breaks = c(&quot;red&quot;, &quot;green&quot;, &quot;brown&quot;, &quot;blue&quot;, &quot;pink&quot;, &quot;black&quot;, &quot;yellow&quot;),
                         labels = c(&quot;Observed&quot;, &quot;Linear&quot;, &quot;Quadratic&quot;, &quot;Cubic&quot;, &quot;Log&quot;, &quot;Power&quot;, &quot;Exponential&quot;),
                         guide = &quot;legend&quot;)
  
  plot + 
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(), 
        panel.background = element_blank(), 
        axis.line = element_line(colour = &quot;black&quot;))+
    theme(axis.text.x = element_text(size = 8, angle=-45, hjust = 0.001), 
          legend.key = element_rect(color = NA, fill = NA))+
    labs(title=&quot;&quot;, x = &quot;Year/quarters&quot;, y = &quot;Smoking prevalence&quot;)+
    scale_x_yearqtr(format='%Y.Q%q')
  </code></pre>