Message Boards Message Boards

8 Replies
2 Total Likes
View groups...
Share this post:

How to change Point Markers in a ListPointPlot3D

Posted 11 years ago
I want to show three lists in one ListPointPlot3D plot. Mathematica shows each list with differently colored points. However, I'd like to indicate the different sets using different point markers. How can I do this?
Show[ListPointPlot3D[{list1, list2, list3}, PlotStyle -> PointSize[0.03], Filling -> Bottom, AspectRatio -> 0.8]]

Many thanks for any advice!
8 Replies
Yes. Any part of the Graphics3D expression can have its primitives manipulated if you can pattern match the structure.

A nice way to get an overview of the expression structure is to slice it into layers by depth using InputForm and Shallow
Shallow[InputForm[lpp3], 7]
Out[]= Graphics3D[{
{Directive[Hue[Skeleton[3]], PointSize[Skeleton[1]]], Point[{Skeleton[961]}]},
{Directive[Hue[Skeleton[3]], PointSize[Skeleton[1]]], Point[{Skeleton[961]}]},
{Directive[Hue[Skeleton[3]], PointSize[Skeleton[1]]], Point[{Skeleton[961]}]}},
{Axes -> True, BoxRatios -> {1, 1, 0.4},
PlotRange -> {{Skeleton[2]}, {Skeleton[2]}, Automatic},
PlotRangePadding -> {{Skeleton[2]}, {Skeleton[2]}, {Skeleton[2]}}}]
Labeling the data portions of the of the primitives gives you a handle to go in and replace with new primitives.
 Show[lpp3 /.
   {{Directive[d1__], Point[p1_]},
     {Directive[d2__], Point[p2_]},
     {Directive[d3__], Point[p3_]}
     } :>
    {{Directive[d1], Cuboid /@ p1},
     {Directive[d2], Point[p2]},
     {Directive[d3], Point[p3]}
This example pattern isolates just the list1 data points and gives you tall "unit cuboids" - because the z dimention is streached with respect to x and y to enhance the contours, automatically. See, BoxRatios -> {1, 1, 0.4}
Nice work around. I will be trying this on some other ways the Graphics3D doesn't do stuff that the two-dimensional routines do.
POSTED BY: Mark Tuttle
Posted 11 years ago
Hi Chris,

That works perfectly to customize the color! It's a pity that the symbols can't be controlled that easily.

Thanks, Martin
The look of the ListPointPlot3D output can be controlled by manupulating the resulting Graphics3D expression internals. Starting with the lpp3 example given by Bruce, extract the directives for primitives in the graphic.
colors = Cases[lpp3, Directive[__], 7]
{Directive[Hue[0.67, 0.6, 0.6], PointSize[0.03]],
Directive[Hue[0.906068, 0.6, 0.6], PointSize[0.03]],
Directive[Hue[0.142136, 0.6, 0.6], PointSize[0.03]]}
newcolors = Thread[colors ->
{Directive[Red, PointSize[0.03`]],
Directive[Green, PointSize[0.03`]],
Directive[Blue, PointSize[0.03`]]}];
Show[lpp3 /. newcolors, SphericalRegion -> True]
Any graphics directives replacements you would like can be used. Here I wrapped the new result in Show to also change a display option. SphericalRegion will help prevent 3D graphics from jumping around on you after being rotated to the desired viewing angle.
Posted 11 years ago
Many thanks, Bruce!

The second approach worked nicely! As you suggested, I created for each list a separate "function that makes pretty items" and then combined these with Show and Graphics3D. 
There isn't a "PlotMarkers" for ListPointPlot3D.

One can disembowel the data structure for the graphic and change
Points to Text or graphics primitives, but that is a lot of work.
list1 = Table[Sin[j^2 + i], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}];
list2 = Table[Sin[j + 2 i], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}];
list3 = Table[Sin[j - i], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}];

lpp3 = ListPointPlot3D[{list1, list2, list3}, PlotStyle -> PointSize[0.03]]
Look at the top of the internal data structure.

Graphics3D[List[List[Directive[Hue[0.67`, 0.6`, 0.6`], PointSize[0.03`]],
Point[List[List[1.`, 1.`, 0.`], List[1.`, 2.`, 0.09983341664682815`],
List[1.`, 3.`, 0.19866933079506122`], ...

It would probably be easier to start with the lists of point coordinates, make them 3D,
list1 = Table[{i, j, Sin[j^2 + i]}, {i, 0, 3, 0.1}, {j, 0, 3, 0.1}];
list1 = Flatten[list1, 1]
create a function that makes pretty items at those coordinates, and use Graphics3D
to turn those into a plot.
mkPoint[{x_, y_, z_}] := {Green, Text["\[FilledDiamond]", {x, y, z}]}
Graphics3D[ Map[mkPoint, list1]]
POSTED BY: Bruce Miller
Right click on your graphand select "Drawing Tools". There will be an option for "points". You can select the points on your graph then modify them with this option.
Posted 11 years ago
Many thanks! However, I was wondering whether it is possible to use an option similar to "PlotMarkers" that works with ListPlot and ListLinePlot but for some reason not with ListPointPlot3D.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract