Update: Another work-around: Use DiscretePlot3D
You can use the datasets xyzData
and predictedZ
to define two functions, say foo1
and foo2
ClearAll[foo1, foo2];
(foo1[Sequence @@foo1[#, #1]#2] = #2#3) & @@@ (xyzData /. {a_, b_, c_} :> {{a, b}, c});xyzData;
(foo2[Sequence @@foo2[#, #1]#2] = #2#3) & @@@ (predictedZ /. {a_, b_, c_} :> {{a, b}, c});predictedZ;
dp3d = DiscretePlot3D[{foo1[x, y], foo2[x, y]},
{x, xyzData[[All, 1]]}, {y, xyzData[[All, 2]]}, ImageSize -> 400,
BoxRatios -> 1, ExtentSize -> 1/10, Filling -> {1 -> {2}},
PlotStyle -> {Blue, Red}, PlotMarkers -> {"Sphere", Small}];
p3d = Plot3D[model[x, y], {x, xMin, xMax}, {y, yMin, yMax},
PlotStyle -> Directive[Opacity[0.1], Specularity[], Glow[White]],
Mesh -> 8, ViewVertical -> {0, 0, 1}];
Show[p3d, dp3d]
Original post:
A work-around: add the vertical lines using Graphics3D
:
Show[ListPointPlot3D[{xyzData, predictedZ}, PlotRange -> All,
PlotStyle -> {Directive[Black, PointSize[Medium]],
Directive[Red, PointSize[Small]]}],
Plot3D[model[x, y], {x, xMin, xMax}, {y, yMin, yMax},
PlotStyle -> Directive[Opacity[0.1], Specularity[], Glow[White]],
Mesh -> 8, ViewVertical -> {0, 0, 1}],
Graphics3D[{Blue, Thick, Line /@ Transpose[{xyzData, predictedZ}]}],
PlotRange -> All, AxesLabel -> {"X", "Y", "Z"},
LabelStyle -> Directive[FontFamily -> "Helvetica"]]