8
$\begingroup$

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?

$\endgroup$
1
  • 1
    $\begingroup$ And where such arrow should be directed to? $\endgroup$ – Kuba May 27 '14 at 8:41
17
$\begingroup$
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

$\endgroup$
1
  • $\begingroup$ Very nice, especially the direct "lpp1 /. Point -> Cuboid" $\endgroup$ – eldo May 27 '14 at 12:51
4
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.