I have 3d data which I'm looking to combine into 2d function. I want to be able to easily evaluate the results.

I'm trying to do something like Show[ListPointPlot3D[data3D],Plot[f[x],{x,0,10000}]]. The direct approach with Show doesn't work since Mathematica doesn't know how to combine the two objects.

The x and y components of 3d points and the function are the same

How do I properly do it?

  • 2
    $\begingroup$ A minimal example including data3D and a f[x] would be useful. In a hurry, Plot returns a Graphics object and ListPointPlot3Da Graphics3D. Thus, you should create a 3D version of your f[x] and use something like ParametricPlot3D to combine both 3D graphics. $\endgroup$ Commented Dec 2, 2017 at 13:39

1 Answer 1


As an example, if you function is f[x]=2*Sin[2*x], and assuming an arbitrary dataset in 3D, your combined plot, where f[x]is plotted in the plane x=0.5 as f[z]=2*Sin[2*y]:

data3D = Transpose@(RandomReal[{#}, 100] & /@ {1, 5, 10});
parametricf = {0.5, t, 2*Sin[2 t]}; parplot = 
ParametricPlot3D[parametricf, {t, 0, 4}, 
PlotStyle -> Thickness[0.01]];
ptsplot = ListPointPlot3D[data3D, AxesLabel -> {"x", "y", "z"}, 
PlotStyle -> PointSize[0.015], ColorFunction -> Hue];
Show[{ptsplot, parplot}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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