Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ListPointPlot3D colors from data

588 views
Skip to first unread message

karl....@gmail.com

unread,
May 2, 2009, 6:00:25 AM5/2/09
to
Hello all,

I have an array of data, with four columns. Each row consists of an X,
Y, Z position, and a value for the data sample from that position F
(X,Y,Z) [where F is not a analytical function, but an experimental
sample value from that position]. What I would like is to plot the
points using something like ListPointPlot3D, with the color of the
point being determined by the value from the fourth column F(X, Y, Z).
How can I do this with Mathematica 7?

Jens-Peer Kuska

unread,
May 4, 2009, 4:40:16 PM5/4/09
to
Hi,

data = Table[RandomReal[{0, 10}, 4], {20000}];

Graphics3D[{Hue[Last[#]/10], Point[Take[#, 3]]} & /@ data]

?
Regards
Jens

Bob Hanlon

unread,
May 4, 2009, 4:41:31 PM5/4/09
to
data = RandomReal[{0, 1}, {50, 4}];

Make every point a separate list and use PlotStyle to set the size and color for each point.

ListPointPlot3D[List /@ Most /@ data,
PlotStyle -> ({
AbsolutePointSize[Ceiling[3 (# + 1)]],
Hue[(# + 1)/2]} & /@ Last /@ data)]


Bob Hanlon

---- karl....@gmail.com wrote:

=============

dh

unread,
May 4, 2009, 4:46:01 PM5/4/09
to

Hi Karl,

you may do this using the ColorFunction option of ListPointPlot.

Towards this aim you must:

1) ensure that F receives actual and not scaled coordinates. This is

done by the option: ColorFunctionScaling -> False

2) The color function "Hue" takes an argument in the range 0..1.

Therefore you must scale the output of F to this range.

Here is an example:

=============================

F[x_, y_, z_] := RandomReal[{-1, 1}];

d = Flatten[Table[{x, y, z}, {x, 0, 3}, {y, 0, 3}, {z, 0, 3}], 2];

ListPointPlot3D[d, ColorFunctionScaling -> False,

ColorFunction -> (Hue[0.5 + 0.5 F[##]] &)]

==============================

Daniel

0 new messages