3
$\begingroup$

This question already has an answer here:

I have the following code that produces a plot of a Normal distribution:

Plot[Table[PDF[NormalDistribution[μ, 3], x], {μ, {4}}] // Evaluate, {x, -15, 15}, 
 Filling -> None, Axes -> {True, True}, Ticks -> None, 
 PlotStyle -> {RGBColor[0.368417, 0.506779, 0.709798],
  RGBColor[0.880722, 0.611041, 0.142051]}]

How do I fill to the left of the y-axis only?

$\endgroup$

marked as duplicate by Mr.Wizard Oct 26 '18 at 16:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4
$\begingroup$

How about this:

 f[x_] := PDF[NormalDistribution[4, 3], x]

Show[Plot[f[x], {x, -15, 15}, Ticks -> None, 
  PlotStyle -> {RGBColor[0.880722, 0.611041, 0.142051]}], 
 Plot[f[x], {x, -15, 0}, 
  PlotStyle -> {RGBColor[0.880722, 0.611041, 0.142051]}, 
  PlotRange -> All, Filling -> Axis]]

enter image description here

$\endgroup$
4
$\begingroup$

ConditionalExpression combined with the option Filling:

Plot[{PDF[NormalDistribution[4, 3], x], ConditionalExpression[0, x <= 0]}, {x, -15, 15}, 
  Ticks -> None, 
  PlotStyle -> {RGBColor[0.880722, 0.611041, 0.142051], None}, 
  Filling -> {1 -> {2}}] 

enter image description here

Plot[Evaluate @ Append[Table[PDF[NormalDistribution[μ, 3], x], {μ, {3, 4, 5}}],
   ConditionalExpression[0, x <= 0]] , {x, -15, 15},  
 Filling -> {1 -> {4}, 2 -> {4}, 3 -> {4}},
 Ticks -> None, 
 PlotStyle -> Append[ColorData[97] /@ {1, 2, 3}, None], 
 PlotLegends -> ("μ = " <> # & /@ {"3", "4", "5"})]

enter image description here

$\endgroup$

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