Re: A question about Graphics3D
- 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)
- Reply-to: hanlonr at cox.net
myData = RandomReal[{-2, 2}, {100, 3}]; Assign color to each point Graphics3D[{ ColorData["Rainbow"] [Rescale[Sqrt[#.#], {0, 2 Sqrt[3]}]], AbsolutePointSize[10], Point[#]} & /@ myData, Axes -> True] Same plot using ListPointPlot3D ListPointPlot3D[myData, BoxRatios -> {1, 1, 1}, PlotStyle -> AbsolutePointSize[10], ColorFunction -> (ColorData["Rainbow"] [Rescale[Sqrt[{##}.{##}], {0, 2 Sqrt[3]}]] &), ColorFunctionScaling -> False] Assign color by grouping of data ListPointPlot3D[ SplitBy[ SortBy[myData, #.# &], Round[Sqrt[#.#]] &], BoxRatios -> {1, 1, 1}, PlotStyle -> AbsolutePointSize[10]] Assign color and shape Module[{r}, Graphics3D[{ ColorData["Rainbow"] [Rescale[r = Sqrt[#.#], {0, 2 Sqrt[3]}]], Scale[If[r < Sqrt[3], 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 ? I need your advice. Marwa Ali -- Bob Hanlon