I'm trying to create a figure of particle distribution from a reference surface in python. I plan to get a distribution in python and then prettify it with tikz. I tried this:
xs = np.linspace(-1, 1, 10) ys = np.linspace(-1, 1, 10) X, Y = np.meshgrid(xs, ys) Z = X for i in range (0, 10): for j in range (0, 10): Z[i][j] = 0 xs = randomrange(10, -1, 1) ys = randomrange(10, -1, 1) zs = randomrange(10, 0, 10) ax.plot_surface(X, Y, Z) ax.scatter(xs, ys, zs)
However, I get a single line with an error message:
/usr/lib/python3.2/site-packages/mpl_toolkits/mplot3d/axes3d.py:1478: RuntimeWarning: nvalid value encountered in true_divide for n in normals])
I assume that this is due to division by 0 (trying to color the surface).
How can I generate a reference surface then?
I tried MRocklin's solution and replaced
Z = X
Z = np.zeros_like(X)
Now I don't get any surface at all...