title: Understanding matplotlib xticks syntax
body: <p>I am reading a book and I came across this code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  plt.scatter(x,y)
  plt.title("Web traffic over the last month")
  plt.xlabel("Time")
  plt.ylabel("Hits/hour")
  plt.xticks([w*7*24 for w in range(10)], 
    ['week %i'%w for w in range(10)])
  plt.autoscale(tight=True)
  plt.grid()
  plt.show()
  </code></pre>
  
  <p>For context, <code>x</code> is an array of integers corresponding to an hour.  <code>y</code> is an array of "hits" (from users to a website) in that particular hour.</p>
  
  <p>I understand that the code accumulates all the hours so that it can display them in a week, <strong>but could someone please explain what these functions do?  My goal is to understand all the syntax of this line:</strong></p>
  
  <pre><code>plt.xticks([w*7*24 for w in range(10)], 
    ['week %i'%w for w in range(10)])
  </code></pre>
  
  <p>Specifically:</p>
  
  <ul>
  <li>What is <code>range</code>?</li>
  </ul>
  
  <p>This is what gets generated:
  <img src="https://i.stack.imgur.com/uC6fX.png" alt="enter image description here"></p>
  
  <p>Here is sample data for additional context:</p>
  
  <pre><code>1   2272
  2   nan
  3   1386
  4   1365
  5   1488
  6   1337
  7   1883
  8   2283
  9   1335
  10  1025
  11  1139
  12  1477
  13  1203
  14  1311
  15  1299
  16  1494
  17  1159
  18  1365
  19  1272
  20  1246
  21  1071
  22  1876
  23  nan
  24  1410
  25  925
  26  1533
  27  2104
  28  2113
  29  1993
  30  1045
  </code></pre>