1
$\begingroup$

Similar to http://forums.wolfram.com/mathgroup/archive/2009/May/msg00133.html or Plot 4D data with color as 4th dimension, I would like to plot single points {x, y, z} in 3D with a 4th value Q as color function where each dataset has its own Q value. So i cannot use a function because each Q has to be connected to its {x, y, z}-set, but the z level is constant for each dataset. For example:

DataA: {{xA1, yA2, zA, QA1}, {xA2, yA2, zA, QA2}, ...
DataB: {{xB1, yB2, zB, QB1}, {xB2, yB2, zB, QB2}, ...

How would this be implemented here?:

circle3D[centre_: {0, 0, 0}, radius_: 20, normal_: {0, 0, 1}, angle_: {0, 2 Pi}] :=Composition[Line, Map[RotationTransform[{{0, 0, 1}, normal}, 
centre], #] &, Map[Append[#, Last@centre] &, #] &, 
Append[DeleteDuplicates[Most@#], Last@#] &, Level[#, {-2}] &,
MeshPrimitives[#, 1] &, DiscretizeRegion, If]
[First@Differences@angle >= 2 Pi, Circle[Most@centre, radius],
Circle[Most@centre, radius, angle]]

colors = 
  {{1, RGBColor[1, 0.11, 0.02, 0.75]}, 
   {2, RGBColor[1, 0.22, 0.23, 0.75]}, 
   {3, RGBColor[1, 0.52, 0, 0.75]}, 
   {4, RGBColor[0.93, 0.79, 0.05, 0.75]}, 
   {5, RGBColor[0.63, 0.84, 0.09, 0.75]}, 
   {6, RGBColor[0.4, 0.86, 0.15, 0.75]}, 
   {7, RGBColor[0.1, 0.86, 0.17, 0.75]}};

Data1 = 
  {{20, 0, z1, 3}, {10, 0, z1, 3}, {0, 0, z1, 3.67}, {-10, 0, z1, 3}, 
   {-20, 0, z1, 3}, {0, 10, z1, 3}, {0, 20, z1, 3}, {0, 10, z1, 3}, 
   {0, -20, z1, 3}, {z1, 100}};
Data2 = 
  {{20, 0, z2, 2.67}, {10, 0, z2, 3.33}, {0, 0, z2, 4}, {0, 10, z2, 3.67}, 
   {0, 20, z2, 2.33}, {0, -10, z2, 3.67}, {0, -20, z2, 2.33}, {-20, 0, z2, 2.67}, 
   {-10, 0, z2, 3.33}, {z2, 200}};

c1 = Graphics3D[{Dashed, circle3D[{0, 0, 100}, 20]}];
c2 = Graphics3D[{Dashed, circle3D[{0, 0, 200}, 20]}];

Show[
  ListPointPlot3D[{Data1, Data2},
    Axes -> True, 
    AxesOrigin -> {0, 0, 0},
    ColorFunction -> (Blend[colors, #1] &),
    ColorFunctionScaling -> False,
    Boxed -> False,
    PlotStyle -> PointSize[0.02],
    PlotRange -> Automatic,
    ImageSize -> Large,
    ViewPoint -> {0.8 Pi, -1.5 Pi, 0.20 Pi}],
  c1, c2] 
$\endgroup$
8
  • $\begingroup$ Possible duplicate of Plot 4D data with color as 4th dimension $\endgroup$
    – chuy
    Feb 23, 2016 at 21:03
  • $\begingroup$ Can you point out what does not work for you in the solutions proposed in the question "Plot 4D data with color as 4th dimension" that you link to? Also, why is the last entry in your Data lists completely different from the others? Can you give us the actual list of data you want to plot? Can you define circle3D, or link to its definition? $\endgroup$
    – MarcoB
    Feb 23, 2016 at 21:28
  • $\begingroup$ You can not plot Data1 and Data2 as you currently define them with ListPointPlot3D because they are not lists of 3D points. You must transform them into such lists and while doing so assign numeric values to z1 and z2. $\endgroup$
    – m_goldberg
    Feb 23, 2016 at 21:52
  • $\begingroup$ @StephanJ, in what way is this answer not the perfect solution to your problem? As your problem is stated, that's the answer, so if it doesn't work for you, let us know why. $\endgroup$
    – Jason B.
    Feb 24, 2016 at 10:36
  • $\begingroup$ Thanks for the hints. Sorry, i missed the circle3D definition, I added this one. My problem with the linked examples are, that there are always functions added, as with the flatten or table option. I here have points in x,y and z position with a certain value for the color (4th value), this value is unique for each data point and i want to link this 4th value to the color function. Only the z value is the same for each data list because all points of one list are located in one z level (Data2 --> z2, and so on). I currently do not now how to transform the data as m_goldberg suggested. $\endgroup$
    – StephanJ
    Feb 24, 2016 at 10:37

0

Browse other questions tagged or ask your own question.