       • To: mathgroup at smc.vnet.net
• Subject: [mg107388] Re: [mg107350] A question about Graphics3D
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Thu, 11 Feb 2010 05:20:18 -0500 (EST)

```myData =
RandomReal[{-2, 2}, {100, 3}];

Assign color to each point

Graphics3D[{
ColorData["Rainbow"]
[Rescale[Sqrt[#.#],
{0, 2 Sqrt}]],
AbsolutePointSize,
Point[#]} & /@ myData,
Axes -> True]

Same plot using ListPointPlot3D

ListPointPlot3D[myData,
BoxRatios -> {1, 1, 1},
PlotStyle -> AbsolutePointSize,
ColorFunction -> (ColorData["Rainbow"]
[Rescale[Sqrt[{##}.{##}],
{0, 2 Sqrt}]] &),
ColorFunctionScaling -> False]

Assign color by grouping of data

ListPointPlot3D[
SplitBy[
SortBy[myData, #.# &],
Round[Sqrt[#.#]] &],
BoxRatios -> {1, 1, 1},
PlotStyle ->
AbsolutePointSize]

Assign color and shape

Module[{r},
Graphics3D[{
ColorData["Rainbow"]
[Rescale[r = Sqrt[#.#],
{0, 2 Sqrt}]],
Scale[If[r < Sqrt, Sphere, Cuboid]
[#], .15]} & /@ myData,
Axes -> True]]

Bob Hanlon

---- Marwa Abd El-Wahaab <m.a.elwahaab at gmail.com> wrote:

=============
Dear Sir,

I am a Mathematica 7 user.

I have two questions about Graphics3D[Point[my data]];

*First question:*
*
*
How can I color some points in my data in the above "Graphics3D" by
different colors?

*Second question:*

How can I represent some points also in my data in the above "Graphics3D" by
shapes like squares , some like triangles and some like circles ?

Marwa Ali

--

Bob Hanlon

```

• Prev by Date: Re: A question about Graphics3D
• Next by Date: Re: A question about Graphics3D