# ListPointPlot3D filling between two lists

I'm trying to connect pairs of corresponding points from two lists in a ListPointPlot3D (similar to what was done here but in 3D). Filling-> {1->{2}} isn't working for me, so I presume the problem must lie in how I'm passing the two lists.

SeedRandom;
sigma = DiagonalMatrix[{0.001, 0.001, 0.000001}];
sp = 5;
means1 = Flatten /@
Transpose[{Table[RandomReal[{0, 1}, 2], {sp}], Table[0.8, {sp}]}];
dist1 = MixtureDistribution[Table[1, {sp}],
Table[MultinormalDistribution[means1[[i]], sigma], {i,
Table[j, {j, sp}]}]
];
means2 = Flatten /@
Transpose[{Table[RandomReal[{0, 1}, 2], {sp}], Table[0.2, {sp}]}];
dist2 = MixtureDistribution[Table[1, {sp}],
Table[MultinormalDistribution[means2[[i]], sigma], {i,
Table[j, {j, sp}]}]
];
n = 50;
data1 = RandomVariate[dist1, n];
data2 = RandomVariate[dist2, n];
ListPointPlot3D[{data1, data2}, PlotRange -> {{0, 1}, {0, 1}, {0, 1}},
Filling -> {1 -> {2}}]

• It seems that for ListPointPlot3D the Filling limits can only be Top, Bottom, Axis or None. Does Graphics3D[{PointSize[Medium], Red, Point[data1], Blue, Point[data2], Gray, Line /@ Transpose[{data1, data2}]}, Boxed -> True] give what you need. – kglr May 3 '19 at 20:26
• Almost! What I'd like to for each point in the top layer to be connected to only one point in the bottom layer. Which point is connected to which is determined by their position (order) in the data (i.e. first point in data1 connects to first point in data2). thanks – user12734 May 3 '19 at 22:06
• user12734, Transpose[{data1, data2}] pairs points from data1 and data2 based on position. – kglr May 3 '19 at 22:41

Show[ListPointPlot3D[{data1, data2}, PlotStyle -> {Red, Blue},
PlotLegends -> {"data1", "data2"}],
Graphics3D[{Gray, Line @ Transpose[{data1, data2}]}]] Alternatively, you can use Graphics3D to plot both points and connecting lines:

Legended[Graphics3D[{PointSize[Medium], Red, Point[data1], Blue,
Point[data2], Gray, Line /@ Transpose[{data1, data2}]}, BoxRatios -> {1, 1, 0.4}],
PointLegend[{Red, Blue}, {"data1", "data2"}]] • You're exactly right! I was thinking about my data incorrectly. thanks! – user12734 May 3 '19 at 23:16

The following might be useful for others to see my mistake:

SeedRandom;
sp = 4;
maxVar = 0.02;
means = Table[RandomReal[{0, 1}, 2], {sp}];
dist = MixtureDistribution[Table[1, {sp}],
Table[BinormalDistribution[means[[i]],
RandomReal[{0.01, maxVar}, 2], 0.5], {i, Table[j, {j, sp}]}]
];
n = 50;
pos = RandomVariate[dist, n];
data1 = Flatten /@ Transpose[{pos, Table[0.8, {n}]}];
data2 = Flatten /@ Transpose[{pos, Table[0.2, {n}]}];

Show[ListPointPlot3D[{data1, data2}, PlotStyle -> {Red, Blue},
PlotLegends -> {"data1", "data2"}],
Graphics3D[{Gray, Line@Transpose[{data1, data2}]}]]