title: Generator of evenly spaced points in a circle in python
body: <p>I am tasked with generating evenly (more or less) spaced points on concentric rings of an invisible circle. The function should take a list of radii, and number of points to plot for a given radius as arguments. For example for a radius of 0 it should plot 1 point at (0,0). For a circle of radius of 1, it should plot 10 points along the circumference of the circle, spaced out by an angle of 2pi/10. For a circle of radius 2, 20 points along the circumference, spaced out by an angle of 2pi/20. </p>
  
  <p>The generator should take the following parameters: </p>
  
  <p>n, r_max, m</p>
  
  <p>and should generate rings of coordinate pairs at radii </p>
  
  <p>r_i = i*r_max/n      for i = 0,1,..,n. </p>
  
  <p>Each ring should have n*i points uniformly distributed in θ where
  n_i=1   for   i=0; n_i = mi for i>0</p>
  
  <p>When the function is called like this:</p>
  
  <pre><code>for r, t in genpolar.rtuniform(n=10, rmax=0.1, m=6):
        plot(r * cos(t), r * sin(t), 'bo')
  </code></pre>
  
  <p>it should return a plot that looks like:
  <a href="https://i.stack.imgur.com/S8HoE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/S8HoE.png" alt="Plot"></a></p>
  
  <p>Here is what I've come up with so far:</p>
  
  <pre><code>def rtpairs(R, N):
          R=[0.0,0.1,0.2]
          N=[1,10,20]
          r=[]
          t=[]
          for i in N:
                  theta=2*np.pi/i
              t.append(theta)
  
          for j in R:
              j=j
              r.append(j)
  
      plt.plot(r*np.cos(t),r*np.sin(t), 'bo')
      plt.show()
  </code></pre>
  
  <p>but I'm pretty sure there is a more efficient method using two for loops.</p>
  
  <p>Many thanks</p>