# 3D plotting?

Is there a way to choose the color map for doing scatter plots using Axes3D? In the test_scatter() example in the class, there is a line something like:

ax.scatter3D(xs,ys,zs, c=‘r’)

I would like to plot points based on 3 dimensional coordinates specified by xs,ys, zs, which works great. However, I would like to color the points with a third array, for example, cs which would either specify an index in a color map, or even just an intensity of a given color. Is this possible within matplotlib?

Thanks,
William

3D plotting in mpl is unmaintained, so I don't recommend relying on it unless you can bring it up to date and maintain it.

After committing a bugfix to svn, the following works with svn mpl and does something like what you want (but might not work with whatever version of mpl you are using.)

···

----------------------------------
from pylab import *
from matplotlib import axes3d
N = 30
x = 0.9*rand(N)
y = 0.9*rand(N)
z = rand(N)
c = rand(N)
area = pi*(10 * rand(N))**2 # 0 to 10 point radiuses
fig = gcf()
ax3d = axes3d.Axes3D(fig)
plt = fig.axes.append(ax3d)

ax3d.scatter(x,y,z,s=area, marker='^', c=c)

show()
-----------------------------------------

A more general problem is that a 3D scatter plot is ambiguous--how do you know where a point really is in 3D? You would have to do something like mapping color to Z. Is that what you want to do?

Eric

william ratcliff wrote:

Is there a way to choose the color map for doing scatter plots using Axes3D? In the test_scatter() example in the class, there is a line something like:

ax.scatter3D(xs,ys,zs, c='r')

I would like to plot points based on 3 dimensional coordinates specified by xs,ys, zs, which works great. However, I would like to color the points with a third array, for example, cs which would either specify an index in a color map, or even just an intensity of a given color. Is this possible within matplotlib?

Thanks,
William

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.