I want to plot two functions in ONE plot, one given as an analytic expression, the other one is numeric.
How can I plot the analytic function continously and discrete points for the numeric function in the SAME plot?
Plot
and DiscretePlot
Show[
Plot[Fibonacci[n], {n, 0, 10}],
DiscretePlot[
Fibonacci[n], {n, 0, 10},
PlotStyle -> Red]]
Plot
and ListPlot
Show[
Plot[Fibonacci[n], {n, 0, 10}],
ListPlot[
{#, Fibonacci[#]} & /@ Range[0, 10],
PlotStyle -> Red,
Filling -> Axis]]
Plot
with Epilog
Plot[Fibonacci[n], {n, 0, 10},
Epilog -> {LightRed,
Line[{{#, 0}, {#, Fibonacci[#]}}] & /@ Range[0, 10],
Red, AbsolutePointSize[4],
Point[{#, Fibonacci[#]} & /@ Range[0, 10]]}]
Plot
and Graphics
Show[
Plot[Fibonacci[n], {n, 0, 10}],
Graphics[{LightRed,
Line[{{#, 0}, {#, Fibonacci[#]}}] & /@ Range[0, 10],
Red, AbsolutePointSize[4],
Point[{#, Fibonacci[#]} & /@ Range[0, 10]]}]]
Show
$\endgroup$Epilog
ofPlot
. If you want to plot both functions together, you may plot them separately (without displaying them) and then combine them usingShow
. $\endgroup$Show[Plot[f, {x, 0, 3}], ListPlot[data], PlotRange -> All]
. If your numeric function is an interpolating functiong
over an interval, say{0, 3}
, thenPlot[{f, g[x]}, {x, 0, 3}]
will do it, but it connect the interpolation data with a smooth interpolating curve; alternatively, usingListPlot[g]
in the first code will plot the interpolation points without connecting them. $\endgroup$