title: R: How do you put the month - year on the X axis of a plot.zoo multiple plot?
body: <p>In a shiny app I would like to put the month - year (i.e. "Jan- 13", "Feb- 13") of a plot.zoo multiple line plot. I have googled and it looks like you have to use a panel and if statement to find the last plot but I still cannot get the month - year to show up on the x axis. </p>
  
  <p>Here is code you can run:</p>
  
  <pre><code>library("zoo")
  
  Factors &lt;- matrix(seq(from=1, to=9, by=1), nrow=3,ncol=3)
  Factors
  datesNumeric &lt;- cbind(20130101, 20130220,20130801)
  dates &lt;- as.Date(as.character(datesNumeric), format="%Y%m%d")
  ticks &lt;- seq(dates[1], dates[length(dates)], by = "1 month") #I make some ticks
  ticks
  
  my.panel &lt;- function(x, y, ..., pf = parent.frame()) {
    grid(NA,NULL)
    #abline(v=seq(1,168,24),col = "lightgray", lty = "dotted", lwd = par("lwd"))
    lines(x, y, ...)
  
    #if bottom panel
    if (with(pf, length(panel.number) == 0 ||panel.number %% nr == 0 || panel.number == nser)) {
      #axis(1, at = ticks, labels = ticks)
      axis.Date(1, at = ticks, format= "%m-%y", las = 1)
    }
   }
  
  plot(as.zoo(Factors), main="Factors 1,2, &amp; 3", ylab=c("Factor 1","Factor 2","Factor 3") ,      xlab= "Date", panel = my.panel,yax.flip=FALSE,col=1:3,xaxt="n")
  </code></pre>
  
  <p>Any idea how to get dates (i.e. "Jan- 13", "Feb- 13", etc...) to show up on the x axis? thank you.</p>