Point style in ListPointPlot3D

8

4

In ListPointPlot3D, it seems the only point style available is the default, because there is no PlotMarkers option for this function. Is there a way to change the point style? For example, what if I want to draw the points as small cubes?

lovespeed

Posted 2014-05-27T08:35:39.550

Reputation: 317

1And where such arrow should be directed to? – Kuba – 2014-05-27T08:41:20.813

Answers

17

lpdata = Table[(4 π - t) {Cos[t + π/2], Sin[t + π/2], 0} + {0, 0, t}, {t, 0, 4 π, .1}];

lpp1 = ListPointPlot3D[lpdata, 
        Filling -> Bottom,  ColorFunction -> "Rainbow", BoxRatios -> 1, 
        FillingStyle -> Directive[LightGreen, Thick, Opacity[.5]],  ImageSize -> 400];

ListPointPlot3D: Post-process Point into Cone

lpp2 = lpp1 /. Point[x__] :> (Sequence@{EdgeForm[], Cone[#, .3]} &@
            ({x} /. {{a_, b_, c_}} :> {{a, b, c}, {a, b, .5 + c}}));

Row[{lpp1, lpp2}, Spacer[5]]

enter image description here

... or into Cuboids

lpp1 /. Point -> Cuboid

enter image description here

DiscretePlot3D: use lpdata to define a function and use the option PlotMarkers

ClearAll[foo];
(foo[Sequence @@ #[[1]]] = #[[2]]) & /@ (lpdata /. {a_, b_, c_} :> {{a, b}, c});
(* or  (foo[Sequence @@ #1] = #2) & @@@ (lpdata /. {a_, b_, c_} :> {{a, b}, c})*) 
 DiscretePlot3D[foo[x, y], {x, lpdata[[All, 1]]}, {y, lpdata[[All, 2]]}, 
   ImageSize -> 400, BoxRatios -> 1, ExtentSize -> 1/5, 
   ColorFunction -> Function[{x, y, z}, ColorData["Rainbow"][z]], 
   PlotMarkers -> {"Sphere", Medium}]

enter image description here

(Unfortunately, Point and Sphere seem to be the only markers that work with DiscretePlot3D.)

BubbleChart3D: append lpdata with 1s and use the options ChartElements or ChartElementFunction

bcdata = {##, 1} & @@@ lpdata;
opts = {ImageSize -> 300, BubbleSizes -> {0.025, .025},
       ChartBaseStyle -> EdgeForm[], ChartStyle -> "Rainbow", ColorFunction -> (#3 &)};

Use the built-in glyphs with the option ChartElementFunction:

Row[BubbleChart3D[bcdata, Evaluate@opts,
   ChartElementFunction -> #] & /@ {"Cone", "Cube","TriangleWaveCube"}, Spacer[5]]

enter image description here

or use the option ChartElements and provide your own graphics objects:

Row[BubbleChart3D[bcdata, Evaluate@opts, ChartElements -> Graphics3D[#]] & /@ 
       {Cone[], Cuboid[], PolyhedronData["Dodecahedron", "Faces"]}, Spacer[5]]

enter image description here

kglr

Posted 2014-05-27T08:35:39.550

Reputation: 302 076

Very nice, especially the direct "lpp1 /. Point -> Cuboid" – eldo – 2014-05-27T12:51:11.683

3

Another possibility is to use Graphics3D. For example (one with Cuboid, one with Sphere):

pts = RandomReal[10, {20, 3}]; 
{Graphics3D[{Blue, Cuboid[#, # + .3 {1, 1, 1}] & /@ pts}], 
 Graphics3D[{Red, Sphere[#, 0.2] & /@ pts}]}

enter image description here

anderstood

Posted 2014-05-27T08:35:39.550

Reputation: 12 994