title: Change labels in X axis using plot() in R
body: <p>I am a beginner in R and am dealing with some data as follows-</p>
  
  <blockquote>
    <p>Month &lt;- 1 2 3 4 5 6 7 8 9 10 11 12 </p>
    
    <p>Sales &lt;- 50 60 80 50 40 30 35 55 70 60 50 40</p>
  </blockquote>
  
  <p>I have to plot these data using the plot() function which I am able to do by doing certain edits to it as follows-</p>
  
  <pre><code>plot(Month, Coffee, type='l', ylim=c(0, 100))
  abline(h=max(Coffee), col='red')
  </code></pre>
  
  <p>The new requirement is to plot the names of 'Month' which is in X-axis as actual month names viz., January, February, March,....., December.</p>
  
  <p>I tried to do that using-</p>
  
  <pre><code>n_month &lt;- format(ISOdate(2017,1:12,1),"%B")
  plot(n_month, Coffee, type='l', ylim=c(0, 100))
  plot(n_month, Coffee, type='l', ylim=c(0, 100), xlim=(1, 12))
  </code></pre>
  
  <p>I also tried the following-</p>
  
  <pre><code># 'xaxt' to suppress labels on x-axis
  plot(Month, Coffee, ylim=c(0,100), xlab="Month", ylab="Coffee", xaxt="n", type='l')
  
  # 'axis' to add in my own labels
  axis(1, at=1:12, labels=month.name)
  </code></pre>
  
  <p>However, the final graph does not mention all the names but rather certain names like- January, March, May, June, July, September &amp; November.</p>
  
  <p>Any suggestions as to how I can get the names of all 12 months on X-axis?</p>
  
  <p>Thanks!</p>