Plotting 3D scatter with python? -
is there module aid me in producing this?
like this, say?
matplotlib 3d scatter plot http://matplotlib.sourceforge.net/_images/scatter3d_demo.png
the matplotlib
examples gallery wonderful thing behold.
code copied linked example.
import numpy np mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot plt def randrange(n, vmin, vmax): return (vmax-vmin)*np.random.rand(n) + vmin fig = plt.figure() ax = fig.add_subplot(111, projection='3d') n = 100 c, m, zl, zh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]: xs = randrange(n, 23, 32) ys = randrange(n, 0, 100) zs = randrange(n, zl, zh) ax.scatter(xs, ys, zs, c=c, marker=m) ax.set_xlabel('x label') ax.set_ylabel('y label') ax.set_zlabel('z label') plt.show()
Comments
Post a Comment