Matplotlib: Plot 2d array radially to make 3d Scatterplot
<p>I am looking to make a plot similar to the one <a href="https://stackoverflow.com/questions/4159942/how-do-you-radially-sweep-out-a-1d-array-to-plot-3d-figure-in-python-to-repr">found here</a>, with the simple difference that I would like to to set the distance from the center for each point.  Ie, given a slice of the plot is a circle, where I would like each of the points to be at a definable distance from the center.</p>

<p>What I a starting with, given a simple modification of the previously mentioned answer:</p>

<pre><code>from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import numpy as np
from scipy.interpolate import interp1d
from matplotlib import cm
from matplotlib import pyplot as plt
step = 0.04
maxval = 1.0
fig = plt.figure()
ax = Axes3D(fig)
# u here would define the desired distance from radial axis
# u=np.array([0,1,2,1,0,2,4,6,4,2,1])
v=np.array([4,4,6,3,6,4,1,4,4,4,4])
r=np.array([0,1,2,3,4,5,6,7,8,9,10])
f=interp1d(r,u)

# walk along the circle
p = np.linspace(0,2*np.pi,len(r))
R,P = np.meshgrid(r,p)
# transform them to cartesian system
X,Y = R*np.cos(P),R*np.sin(P)

Z=f(R)

ax.scatter(X, Y, Z)#, rstride=1, cstride=1, cmap=cm.jet)
ax.set_xticks([])
fig.savefig(str(output_prefix + '3d..png'), dpi=(200))
</code></pre>

<p><a href="https://i.stack.imgur.com/ehKoo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ehKoo.png" alt="enter image description here"></a>
What I would like to plot (apologies for the blurred sketch):
 <a href="https://i.stack.imgur.com/7U7QS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7U7QS.jpg" alt="enter image description here"></a></p>

<p>I have tried using interp2d to add the <code>u</code> variable commented out above, but no luck.  Changing <code>Z</code> to the array <code>u</code> threw the error that X, Y, and Z must be the same size (<code>"Argument 'zs' must be of same size as 'xs' "</code>, understandably as X and Y are now interpolated) What do I need to do? Any tips would be appreciated!  </p>