title: Extrapolated contour plot using numpy
body: <p>I have data which is taken along the diameter of a circle in 1 mm increments i.e. starting at 90 degrees and ending at 270 degrees. I want to extrapolate the data at each 1 mm increment to fill in the rest of the circle (at that radial point). For example:  </p>
  
  <p>10 mm circle:  </p>
  
  <pre><code>&gt;Distance along diameter (mm)     Value (a.u.)  
  &gt;1                 208  
  &gt;5                 210  (centre `(0,0)`)  
  &gt;7                 209  
  &gt;10                208
  </code></pre>
  
  <p>Now I want something similar to: <a href="https://i.stack.imgur.com/aflXR.png" rel="nofollow noreferrer">this image</a>. With a legend/key on the right hand side and with the data extrapolated, so that the transitions are 'smooth' between the radial data points. Obviously, only one radius of values should really be needed, but I want the other half of the values in the diameter to reinforce the values observed in the first radius. </p>
  
  <p>So, I want the values of the bottom radius to 'blend' in with the values of the top radius along the diameter from 180 degrees to 0 degrees. Is this clear?</p>
  
  <p>My initial (terrible):</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  data = np.genfromtxt('data.txt',delimiter=',')
  
  r = data[:,][:,0]
  values = data[:,][:,1]
  theta = np.zeros(len(data))
  
  r, theta = np.meshgrid(r, theta)    
  plt.figure()
  fig, ax = plt.subplots(subplot_kw=dict(projection='polar'))
  ax.contourf(theta, r, values)
  plt.show()
  </code></pre>
  
  <p>I understand that the input to <code>ax.contourf</code> must be a 2D array. I have no real theta values for my data, however. I just want a series of concentric circles, so I have modified my data as:</p>
  
  <pre><code>80,0,208.1790755
  80,90,208.1790755
  80,180,208.1790755
  80,270,208.1790755
  79,0,208.1322654
  79,90,208.1322654
  79,180,208.1322654
  79,270,208.1322654
  76,0,208.1804241
  76,90,208.1804241
  76,180,208.1804241
  76,270,208.1804241
  etc
  </code></pre>
  
  <p>I can't see why the following won't work, though:</p>
  
  <pre><code>data = np.genfromtxt('data.txt',delimiter=',')
  
  r = data[:,][:,0]
  values = np.array(data[:,][:,2])
  theta = np.radians(data[:,][:,1])
  
  r, theta = np.meshgrid(r, theta)
  
  fig, ax = plt.subplots(subplot_kw=dict(projection='polar'))
  ax.contourf(theta, r, values)
  plt.show()
  </code></pre>