# 3D plots with a continuous and discrete input [duplicate]

How can I plot a function with one discrete and one continuous input? Plot3D wants everything continuous while ListPlot3D and ListPointPlot3D want everything discrete. I would like be able to say something like

HybridPlot[f[dsc, cnt], {dsc , min, max step}, {cnt, min max}]


or

HybridPlot[f[dsc, cnt], {dsc, someArray}, {cnt, min max}]


I am not seeing a simple way to do this in the docs.

-

## marked as duplicate by Silvia, ciao, Michael E2, m_goldberg, R. M.♦Mar 28 '14 at 5:51

Actually I think this is a duplicate of Plotting several functions. Heike's answer there is the same as the one I posted here. – Rahul Mar 28 '14 at 0:21

If I understand the question correctly, you want to plot $f(a,x)$ as a function of $a$ and $x$, except that $a$ takes discrete values and $x$ lies in a continuous range. Maybe something like

f[a_, x_] := Exp[-x] x^(a - 1)/(a - 1)!


Then the graph of $f$ isn't a surface but a collection of curves $x\mapsto f(a,x)$, one for each discrete value of $a$. You could draw this using a parametric plot like

ParametricPlot3D[Evaluate@Table[{x, a, f[a, x]}, {a, 1, 5}], {x, 0, 10}, BoxRatios -> 1]


or maybe (this one is quite a hack)

ParametricPlot3D[Evaluate@Table[{x, a, z}, {a, 1, 5}], {x, 0, 10}, {z, 0, 0.5},
RegionFunction -> Function[{x, a, z}, z < f[a, x]],
BoxRatios -> 1, Mesh -> None, BoundaryStyle -> Black, MaxRecursion -> 5,
Lighting -> {{"Ambient", LightGray}}]


-
How to adapt your solution to plot curves given by implicit equations? For example, the family of circles $x^2+y^2=r^2$ for $1\leq r \leq 2$ plotted at different heights with respect to the radius. – Sigur Mar 29 '14 at 16:39
@Sigur: The second example will do the job; just replace the RegionFunction $z<f(a,x)$ with your implicit equation. – Rahul Mar 29 '14 at 20:33

You can combine the plots with something like Show:

p1 = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, PlotRange -> {{-3, 3}, {-2, 2},
{-1, 1}}]
p2 =ListPlot3D[Flatten[Table[{x, y, Sin[-x + y^2] + .1}, {x, -3, 3, .1}, {y, -2,
2, .1}], 1], ColorFunction -> "SouthwestColors"]

Show[{p1, p2}]


You could also look at Prolog and Epilog to accomplish similar - lots of ways to skin this cat...

-