# Drawing a vertical line at the mean of a bell curve

I have this code here:

Plot[MapThread[
Function[{\[Mu], \[Sigma]},
PDF[NormalDistribution[\[Mu], \[Sigma]], x]], {{1,2,3,4,5}, {0.5,1.0,1.5,2.0,2.5}}] // Evaluate, {x, -10, 10},
Filling -> Axis,
PlotLegends ->
LineLegend[{"Five Years", "Three Years", "One Year", "Six Months",
"Three Months"}],
PlotStyle -> {Thickness[.001], Thickness[.002], Thickness[.003],
Thickness[.004], Thickness[.005]}]


which creates five bell curves in a single graph. I would like to add a vertical line at the mean of each curve (at its peak) that begins at the curve and ends at the x-axis. In other words, a vertical line at x=1, x=2 ... x=5. Could I gain any insight into how this could be accomplished?

Following D.G. Stork:

Plot[
MapThread[Function[{\[Mu], \[Sigma]}, PDF[NormalDistribution[\[Mu], \[Sigma]], x]], {{1, 2, 3, 4,5}, {0.5, 1.0, 1.5, 2.0, 2.5}}] // Evaluate, {x, -10, 10},
Filling -> Axis,PlotLegends -> LineLegend[{"Five Years", "Three Years", "One Year", "Six Months",
"Three Months"}],
PlotStyle -> {Thickness[.001], Thickness[.002], Thickness[.003],
Thickness[.004], Thickness[.005]}, PlotRange -> {{0, 10}, All},
Epilog -> ({Red, Dashing[0.01],
{
{1, 2, 3, 4, 5},
PDF[NormalDistribution[\[Mu], \[Sigma]], \[Mu]]], {{1, 2,3, 4, 5}, {0.5, 1.0, 1.5, 2.0, 2.5}}])
}
]
})
]


• What does the filling between the density curve and the axis designate? – wolfies Nov 15 '17 at 16:21
• You can remove it from the graph if you want. Nothing special, except you wanted to indicate or assign something useful to the area below the curve. – José Antonio Díaz Navas Nov 15 '17 at 18:33
Epilog-> Line[{{#,0},{#,.25}}]& /@ Range[5]


or more generally

Epilog-> Line[{{#,0},{#,.25}}]& /@ {1,2,3,4,5}


where the list is the list of the means.

• Note that you can use HalfLine if you want a line that doesn't terminate. – Sjoerd Smit Nov 14 '17 at 9:34

You could also combine a Plot[] and a ListPlot[] with the setting Filling -> Axis:

Show[Plot[MapThread[
Function[{μ, σ}, PDF[NormalDistribution[μ, σ], x]],
{{1, 2, 3, 4, 5}, {0.5, 1.0, 1.5, 2.0, 2.5}}] // Evaluate,
{x, -10, 10}, Filling -> Axis,
PlotLegends -> LineLegend[{"Five Years", "Three Years", "One Year",
"Six Months", "Three Months"}], PlotRange -> All,
PlotStyle -> {Thickness[.001], Thickness[.002], Thickness[.003],
Thickness[.004], Thickness[.005]}],
Function[{μ, σ}, {{μ, PDF[NormalDistribution[μ, σ], μ]}}],
{{1, 2, 3, 4, 5}, {0.5, 1.0, 1.5, 2.0, 2.5}}], Filling -> Axis,
FillingStyle -> Transpose[{{Thickness[.001], Thickness[.002], Thickness[.003],
Thickness[.004], Thickness[.005]}}]],
Axes -> None, Frame -> True]


For completeness here's an approach with GridLines (that fails the peak-to-axis criterion) and another combining two plots, the latter with a Filling->Axis option. Although I don't necessarily think these are better solutions they can potentially reduce a cluttered Plot command - I would personally favour the first if I wanted a quick solution and the second if I wanted more control over the lines.

Plot[MapThread[
Function[{\[Mu], \[Sigma]},
PDF[NormalDistribution[\[Mu], \[Sigma]], x]], {{1, 2, 3, 4,
5}, {0.5, 1.0, 1.5, 2.0, 2.5}}] // Evaluate, {x, -10, 10},
Filling -> Axis,
PlotLegends ->
LineLegend[{"Five Years", "Three Years", "One Year", "Six Months",
"Three Months"}],
PlotStyle -> {Thickness[.001], Thickness[.002], Thickness[.003],
Thickness[.004], Thickness[.005]},
GridLines -> {{1, 2, 3, 4, 5}, None},
PlotRange -> All,
Epilog ->
Point[MapThread[{#1, PDF[NormalDistribution[#1, #2], #1]} &, {{1, 2,
3, 4, 5}, {0.5, 1.0, 1.5, 2.0, 2.5}}]]]


Show[Plot[
Function[{\[Mu], \[Sigma]},
PDF[NormalDistribution[\[Mu], \[Sigma]], x]], {{1, 2, 3, 4,
5}, {0.5, 1.0, 1.5, 2.0, 2.5}}] // Evaluate, {x, -10, 10},
Filling -> Axis,
PlotLegends ->
LineLegend[{"Five Years", "Three Years", "One Year", "Six Months",
"Three Months"}],
PlotStyle -> {Thickness[.001], Thickness[.002], Thickness[.003],
Thickness[.004], Thickness[.005]}, PlotRange -> All],
ListPlot[